Skip to content

Commit

Permalink
Make error handling in attribute_branch_pkg more robust
Browse files Browse the repository at this point in the history
  • Loading branch information
marcus-h committed Mar 14, 2017
1 parent 3e2bb0e commit 8bb903f
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions osc/core.py
Expand Up @@ -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
Expand Down

0 comments on commit 8bb903f

Please sign in to comment.