fixed improper error handling when data is not valid JSON (#1326)
This commit is contained in:
parent
88b8ca8a49
commit
9ab256df30
2 changed files with 5 additions and 4 deletions
|
@ -14,7 +14,7 @@ at anytime.
|
|||
|
||||
### Fixed
|
||||
* loggly error reporting not following `share_usage_data`
|
||||
*
|
||||
* improper error handling when data is not valid JSON
|
||||
|
||||
### Deprecated
|
||||
* automatic claim renew, this is no longer needed
|
||||
|
|
|
@ -298,12 +298,13 @@ class AuthJSONRPCServer(AuthorizedBase):
|
|||
# maybe its a twisted Failure with another type of error
|
||||
error = JSONRPCError(failure.getErrorMessage() or failure.type.__name__,
|
||||
traceback=failure.getTraceback())
|
||||
if not failure.check(ComponentsNotStarted, ComponentStartConditionNotMet):
|
||||
log.warning("error processing api request: %s\ntraceback: %s", error.message,
|
||||
"\n".join(error.traceback))
|
||||
else:
|
||||
# last resort, just cast it as a string
|
||||
error = JSONRPCError(str(failure))
|
||||
if not failure.check(ComponentsNotStarted, ComponentStartConditionNotMet):
|
||||
log.warning("error processing api request: %s\ntraceback: %s", error.message,
|
||||
"\n".join(error.traceback))
|
||||
|
||||
response_content = jsonrpc_dumps_pretty(error, id=id_)
|
||||
self._set_headers(request, response_content)
|
||||
request.setResponseCode(200)
|
||||
|
|
Loading…
Reference in a new issue