1
0
mirror of https://github.com/openSUSE/osc.git synced 2024-11-10 06:46:15 +01:00

Make error handling in attribute_branch_pkg more robust

This commit is contained in:
Marcus Huewe 2017-03-14 22:50:48 +01:00
parent 3e2bb0ec1d
commit 8bb903f41c

View File

@ -5085,9 +5085,11 @@ def attribute_branch_pkg(apiurl, attribute, maintained_update_project_attribute,
try: try:
f = http_POST(u) f = http_POST(u)
except HTTPError as e: except HTTPError as e:
msg = ''.join(e.readlines()) root = ET.fromstring(e.read())
msg = msg.split('<summary>')[1] summary = root.find('summary')
msg = msg.split('</summary>')[0] if summary is not None and summary.text is not None:
raise oscerr.APIError(summary.text)
msg = 'unexpected response: %s' % ET.tostring(root, encoding=ET_ENCODING)
raise oscerr.APIError(msg) raise oscerr.APIError(msg)
r = None r = None