Improved error messages

pull/41656/head
Jose Delarosa 6 years ago
parent a5133d56b8
commit 66a7dcd789

@ -38,7 +38,7 @@ class RedfishUtils(object):
return {'ret': False, 'msg': "URL Error: %s" % e.reason} return {'ret': False, 'msg': "URL Error: %s" % e.reason}
# Almost all errors should be caught above, but just in case # Almost all errors should be caught above, but just in case
except: except:
return {'ret': False, 'msg': "Unknown error"} return {'ret': False, 'msg': "Unknown error %s" % str(e)}
return {'ret': True, 'data': data} return {'ret': True, 'data': data}
def post_request(self, uri, pyld, hdrs): def post_request(self, uri, pyld, hdrs):
@ -55,7 +55,7 @@ class RedfishUtils(object):
return {'ret': False, 'msg': "URL Error: %s" % e.reason} return {'ret': False, 'msg': "URL Error: %s" % e.reason}
# Almost all errors should be caught above, but just in case # Almost all errors should be caught above, but just in case
except: except:
return {'ret': False, 'msg': "Unknown error"} return {'ret': False, 'msg': "Unknown error %s" % str(e)}
return {'ret': True, 'resp': resp} return {'ret': True, 'resp': resp}
def patch_request(self, uri, pyld, hdrs): def patch_request(self, uri, pyld, hdrs):
@ -72,7 +72,7 @@ class RedfishUtils(object):
return {'ret': False, 'msg': "URL Error: %s" % e.reason} return {'ret': False, 'msg': "URL Error: %s" % e.reason}
# Almost all errors should be caught above, but just in case # Almost all errors should be caught above, but just in case
except: except:
return {'ret': False, 'msg': "Unknown error"} return {'ret': False, 'msg': "Unknown error %s" % str(e)}
return {'ret': True, 'resp': resp} return {'ret': True, 'resp': resp}
def delete_request(self, uri, pyld, hdrs): def delete_request(self, uri, pyld, hdrs):
@ -89,7 +89,7 @@ class RedfishUtils(object):
return {'ret': False, 'msg': "URL Error: %s" % e.reason} return {'ret': False, 'msg': "URL Error: %s" % e.reason}
# Almost all errors should be caught above, but just in case # Almost all errors should be caught above, but just in case
except: except:
return {'ret': False, 'msg': "Unknown error"} return {'ret': False, 'msg': "Unknown error %s" % str(e)}
return {'ret': True, 'resp': resp} return {'ret': True, 'resp': resp}
def _init_session(self): def _init_session(self):

Loading…
Cancel
Save