|
|
|
@ -84,6 +84,17 @@ def wrap_json_request_handler(h): |
|
|
|
|
logger.info( |
|
|
|
|
"%s SynapseError: %s - %s", request, code, e.msg |
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
# Only respond with an error response if we haven't already started |
|
|
|
|
# writing, otherwise lets just kill the connection |
|
|
|
|
if request.startedWriting: |
|
|
|
|
if request.transport: |
|
|
|
|
try: |
|
|
|
|
request.transport.abortConnection() |
|
|
|
|
except Exception: |
|
|
|
|
# abortConnection throws if the connection is already closed |
|
|
|
|
pass |
|
|
|
|
else: |
|
|
|
|
respond_with_json( |
|
|
|
|
request, code, e.error_dict(), send_cors=True, |
|
|
|
|
pretty_print=_request_user_agent_is_curl(request), |
|
|
|
@ -100,6 +111,16 @@ def wrap_json_request_handler(h): |
|
|
|
|
request, |
|
|
|
|
f.getTraceback().rstrip(), |
|
|
|
|
) |
|
|
|
|
# Only respond with an error response if we haven't already started |
|
|
|
|
# writing, otherwise lets just kill the connection |
|
|
|
|
if request.startedWriting: |
|
|
|
|
if request.transport: |
|
|
|
|
try: |
|
|
|
|
request.transport.abortConnection() |
|
|
|
|
except Exception: |
|
|
|
|
# abortConnection throws if the connection is already closed |
|
|
|
|
pass |
|
|
|
|
else: |
|
|
|
|
respond_with_json( |
|
|
|
|
request, |
|
|
|
|
500, |
|
|
|
|