Don't fail if ConnectionError has no code (#53455)

Fall back to normal error handling instead
This commit is contained in:
Nathaniel Case 2019-03-07 10:04:08 -05:00 committed by GitHub
parent e55e8fe2c4
commit 72eb8672bf
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -45,7 +45,10 @@ class JsonRpcServer(object):
result = rpc_method(*args, **kwargs)
except ConnectionError as exc:
display.vvv(traceback.format_exc())
try:
error = self.error(code=exc.code, message=to_text(exc))
except AttributeError:
error = self.internal_error(data=to_text(exc))
response = json.dumps(error)
except Exception as exc:
display.vvv(traceback.format_exc())