Skip to content
Snippets Groups Projects
Commit f48792ee authored by Kegan Dougal's avatar Kegan Dougal
Browse files

Reduce the amount of incredibly spammy stack traces. Expected errors (e.g....

Reduce the amount of incredibly spammy stack traces. Expected errors (e.g. SynapseErrors) shouldn't have their full trace logged every time. Don't send responses to disconnected requests.
parent 509ce6c1
No related branches found
No related tags found
Loading
...@@ -132,7 +132,11 @@ class JsonResource(HttpServer, resource.Resource): ...@@ -132,7 +132,11 @@ class JsonResource(HttpServer, resource.Resource):
{"error": "Unrecognized request"} {"error": "Unrecognized request"}
) )
except CodeMessageException as e: except CodeMessageException as e:
logger.exception(e) if isinstance(e, SynapseError):
logger.error("%s SynapseError: %s - %s", request, e.code,
e.msg)
else:
logger.exception(e)
self._send_response( self._send_response(
request, request,
e.code, e.code,
...@@ -147,6 +151,14 @@ class JsonResource(HttpServer, resource.Resource): ...@@ -147,6 +151,14 @@ class JsonResource(HttpServer, resource.Resource):
) )
def _send_response(self, request, code, response_json_object): def _send_response(self, request, code, response_json_object):
# could alternatively use request.notifyFinish() and flip a flag when
# the Deferred fires, but since the flag is RIGHT THERE it seems like
# a waste.
if request._disconnected:
logger.warn(
"Not sending response to request %s, already disconnected.",
request)
return
if not self._request_user_agent_is_curl(request): if not self._request_user_agent_is_curl(request):
json_bytes = encode_canonical_json(response_json_object) json_bytes = encode_canonical_json(response_json_object)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment