deposit.client: Improve error message instead of xml parsing failure
Currently, our deposit backends (not the api, the backend below) is down due to maintenance [1]
This results in unrelated parsing failure issues in the deposit clients:
Traceback (most recent call last):
File "/home/user/swh/python3env/bin/swh", line 8, in <module>
sys.exit(main())
File "/home/user/swh/python3env/lib/python3.7/site-packages/swh/core/cli/__init__.py", line 122, in main
return swh(auto_envvar_prefix="SWH")
File "/home/user/swh/python3env/lib/python3.7/site-packages/click/core.py", line 829, in __call__
return self.main(*args, **kwargs)
File "/home/user/swh/python3env/lib/python3.7/site-packages/click/core.py", line 782, in main
rv = self.invoke(ctx)
File "/home/user/swh/python3env/lib/python3.7/site-packages/click/core.py", line 1259, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/home/user/swh/python3env/lib/python3.7/site-packages/click/core.py", line 1259, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/home/user/swh/python3env/lib/python3.7/site-packages/click/core.py", line 1066, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/home/user/swh/python3env/lib/python3.7/site-packages/click/core.py", line 610, in invoke
return callback(*args, **kwargs)
File "/home/user/swh/python3env/lib/python3.7/site-packages/click/decorators.py", line 21, in new_func
return f(get_current_context(), *args, **kwargs)
File "/home/user/swh/python3env/lib/python3.7/site-packages/swh/deposit/cli/client.py", line 440, in upload
r = deposit_create(config, logger)
File "/home/user/swh/python3env/lib/python3.7/site-packages/swh/deposit/cli/client.py", line 274, in deposit_create
return client.deposit_create(**_subdict(config, keys))
File "/home/user/swh/python3env/lib/python3.7/site-packages/swh/deposit/client.py", line 582, in deposit_create
collection, archive, metadata, in_progress, slug
File "/home/user/swh/python3env/lib/python3.7/site-packages/swh/deposit/client.py", line 304, in execute
error = self.parse_result_error(r.text)
File "/home/user/swh/python3env/lib/python3.7/site-packages/swh/deposit/client.py", line 267, in parse_result_error
xml_content, keys=["summary", "detail", "sword:verboseDescription"]
File "/home/user/swh/python3env/lib/python3.7/site-packages/swh/deposit/client.py", line 61, in _parse_with_filter
data = _parse(stream, encoding=encoding)
File "/home/user/swh/python3env/lib/python3.7/site-packages/swh/deposit/client.py", line 39, in _parse
data = xmltodict.parse(stream, encoding=encoding, process_namespaces=False)
File "/home/user/swh/python3env/lib/python3.7/site-packages/xmltodict.py", line 327, in parse
parser.Parse(xml_input, True)
xml.parsers.expat.ExpatError: syntax error: line 1, column 49
This needs to be improved.
Migrated from T2401 (view on Phabricator)