repr errors before creating APIGenericErrorResponse's

Many of the errors that Voltron encounters __str__ into an empty string,
but __repr__ into a useful string describing the error.
This commit is contained in:
Richo Healey 2016-03-22 17:47:09 +00:00
parent 21a78ea7c0
commit ab87fc30a3
8 changed files with 8 additions and 8 deletions

View File

@ -21,7 +21,7 @@ class FormatDisassemblyRequest(APIRequest):
res = FormatDisassemblyResponse( res = FormatDisassemblyResponse(
disassembly=pygments.highlight(self.disassembly.strip(), LLDBIntelLexer(), pygments.formatters.HtmlFormatter())) disassembly=pygments.highlight(self.disassembly.strip(), LLDBIntelLexer(), pygments.formatters.HtmlFormatter()))
except Exception as e: except Exception as e:
msg = "Exception formatting disassembly: {}".format(e) msg = "Exception formatting disassembly: {}".format(repr(e))
log.exception(msg) log.exception(msg)
res = APIGenericErrorResponse(msg) res = APIGenericErrorResponse(msg)

View File

@ -250,7 +250,7 @@ class Server(object):
try: try:
res = req.dispatch() res = req.dispatch()
except Exception as e: except Exception as e:
msg = "Exception raised while dispatching request: {}".format(e) msg = "Exception raised while dispatching request: {}".format(repr(e))
log.exception(msg) log.exception(msg)
res = APIGenericErrorResponse(msg) res = APIGenericErrorResponse(msg)

View File

@ -29,7 +29,7 @@ class APIBreakpointsRequest(APIRequest):
except NoSuchTargetException: except NoSuchTargetException:
res = APINoSuchTargetErrorResponse() res = APINoSuchTargetErrorResponse()
except Exception as e: except Exception as e:
msg = "Exception getting breakpoints: {}".format(e) msg = "Exception getting breakpoints: {}".format(repr(e))
log.exception(msg) log.exception(msg)
res = APIGenericErrorResponse(msg) res = APIGenericErrorResponse(msg)

View File

@ -30,7 +30,7 @@ class APICommandRequest(APIRequest):
except NoSuchTargetException: except NoSuchTargetException:
res = APINoSuchTargetErrorResponse() res = APINoSuchTargetErrorResponse()
except Exception as e: except Exception as e:
msg = "Exception executing debugger command: {}".format(e) msg = "Exception executing debugger command: {}".format(repr(e))
log.exception(msg) log.exception(msg)
res = APIGenericErrorResponse(msg) res = APIGenericErrorResponse(msg)

View File

@ -31,7 +31,7 @@ class APIDerefRequest(APIRequest):
except NoSuchTargetException: except NoSuchTargetException:
res = APINoSuchTargetErrorResponse() res = APINoSuchTargetErrorResponse()
except Exception as e: except Exception as e:
msg = "Exception dereferencing pointer: {}".format(e) msg = "Exception dereferencing pointer: {}".format(repr(e))
log.exception(msg) log.exception(msg)
res = APIGenericErrorResponse(msg) res = APIGenericErrorResponse(msg)

View File

@ -104,7 +104,7 @@ class APIMemoryRequest(APIRequest):
except NoSuchTargetException: except NoSuchTargetException:
res = APINoSuchTargetErrorResponse() res = APINoSuchTargetErrorResponse()
except Exception as e: except Exception as e:
msg = "Exception getting memory from debugger: {}".format(e) msg = "Exception getting memory from debugger: {}".format(repr(e))
log.exception(msg) log.exception(msg)
res = APIGenericErrorResponse(msg) res = APIGenericErrorResponse(msg)

View File

@ -43,7 +43,7 @@ class APIRegistersRequest(APIRequest):
except NoSuchTargetException: except NoSuchTargetException:
res = APINoSuchTargetErrorResponse() res = APINoSuchTargetErrorResponse()
except Exception as e: except Exception as e:
msg = "Exception getting registers from debugger: {}".format(e) msg = "Exception getting registers from debugger: {}".format(repr(e))
log.exception(msg) log.exception(msg)
res = APIGenericErrorResponse(msg) res = APIGenericErrorResponse(msg)

View File

@ -26,7 +26,7 @@ class APITargetsRequest(APIRequest):
except NoSuchTargetException: except NoSuchTargetException:
res = APINoSuchTargetErrorResponse() res = APINoSuchTargetErrorResponse()
except Exception as e: except Exception as e:
msg = "Exception getting targets from debugger: {}".format(e) msg = "Exception getting targets from debugger: {}".format(repr(e))
log.exception(msg) log.exception(msg)
res = APIGenericErrorResponse(msg) res = APIGenericErrorResponse(msg)