mirror of
https://opendev.org/x/pyghmi
synced 2026-01-10 18:22:32 +00:00
Enhance vague error messages
Certain scenarios resulted in blank errors during failure. Provide a fallback that preserves some amount of information. Change-Id: Ib08f3a602f2133d04662ec45c7caf90477ffbb70
This commit is contained in:
@@ -2098,13 +2098,14 @@ class XCCClient(IMMClient):
|
||||
'progress': 100 * wc.get_upload_progress()})
|
||||
if uploadthread.rspstatus >= 300 or uploadthread.rspstatus < 200:
|
||||
rsp = uploadthread.rsp
|
||||
errmsg = ''
|
||||
errmsg = f'Upload failed with HTTP status {uploadthread.rspstatus}'
|
||||
try:
|
||||
rsp = json.loads(rsp)
|
||||
errmsg = (
|
||||
rsp['error']['@Message.ExtendedInfo'][0]['Message'])
|
||||
except Exception:
|
||||
raise Exception(uploadthread.rsp)
|
||||
errmsg = errmsg + ': ' + str(rsp)
|
||||
raise Exception(errmsg)
|
||||
raise Exception(errmsg)
|
||||
rsp = json.loads(uploadthread.rsp)
|
||||
monitorurl = rsp['@odata.id']
|
||||
|
||||
@@ -1088,14 +1088,15 @@ class OEMHandler(object):
|
||||
if (uploadthread.rspstatus >= 300
|
||||
or uploadthread.rspstatus < 200):
|
||||
rsp = uploadthread.rsp
|
||||
errmsg = ''
|
||||
errmsg = f'Update attempt resulted in response status {uploadthread.rspstatus}'
|
||||
try:
|
||||
rsp = json.loads(rsp)
|
||||
errmsg = (
|
||||
rsp['error'][
|
||||
'@Message.ExtendedInfo'][0]['Message'])
|
||||
except Exception:
|
||||
raise Exception(uploadthread.rsp)
|
||||
errmsg = errmsg + ': ' + repr(rsp)
|
||||
raise Exception(errmsg)
|
||||
raise Exception(errmsg)
|
||||
return self.continue_update(uploadthread, progress)
|
||||
finally:
|
||||
|
||||
@@ -1320,14 +1320,15 @@ class OEMHandler(generic.OEMHandler):
|
||||
if (uploadthread.rspstatus >= 300
|
||||
or uploadthread.rspstatus < 200):
|
||||
rsp = uploadthread.rsp
|
||||
errmsg = ''
|
||||
errmsg = f'Update attempt resulted in response status {uploadthread.rspstatus}'
|
||||
try:
|
||||
rsp = json.loads(rsp)
|
||||
errmsg = (
|
||||
rsp['error'][
|
||||
'@Message.ExtendedInfo'][0]['Message'])
|
||||
except Exception:
|
||||
raise Exception(uploadthread.rsp)
|
||||
errmsg = f'Update attempt resulted in response status {uploadthread.rspstatus}: "{repr(rsp)}"'
|
||||
raise Exception(errmsg)
|
||||
raise Exception(errmsg)
|
||||
rsp = json.loads(uploadthread.rsp)
|
||||
monitorurl = rsp['@odata.id']
|
||||
|
||||
Reference in New Issue
Block a user