1
0
mirror of https://github.com/GNS3/gns3-server synced 2024-12-23 23:38:21 +00:00

Properly handle when client cancel's query

This commit is contained in:
Julien Duponchelle 2015-02-25 11:42:02 +01:00
parent 7c2329d870
commit 0713724a97
2 changed files with 10 additions and 1 deletions

View File

@ -17,6 +17,7 @@
import raven
import json
import asyncio.futures
from .version import __version__
from .config import Config
@ -47,7 +48,10 @@ class CrashReport:
"url": request.path,
"data": request.json,
})
self._client.captureException()
try:
self._client.captureException()
except asyncio.futures.TimeoutError:
pass # We don't care if we can send the bug report
@classmethod
def instance(cls):

View File

@ -136,6 +136,11 @@ class Route(object):
response = Response(route=route)
response.set_status(409)
response.json({"message": str(e), "status": 409})
except asyncio.futures.CancelledError as e:
log.error("Request canceled")
response = Response(route=route)
response.set_status(408)
response.json({"message": "Request canceled", "status": 408})
except Exception as e:
log.error("Uncaught exception detected: {type}".format(type=type(e)), exc_info=1)
response = Response(route=route)