1
0
mirror of https://github.com/openSUSE/osc.git synced 2024-09-20 01:06:17 +02: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:
f = http_POST(u)
except HTTPError as e:
msg = ''.join(e.readlines())
msg = msg.split('<summary>')[1]
msg = msg.split('</summary>')[0]
root = ET.fromstring(e.read())
summary = root.find('summary')
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)
r = None