mirror of
https://github.com/GNS3/gns3-server.git
synced 2025-01-18 07:23:47 +02:00
Properly handle when client cancel's query
This commit is contained in:
parent
7c2329d870
commit
0713724a97
@ -17,6 +17,7 @@
|
|||||||
|
|
||||||
import raven
|
import raven
|
||||||
import json
|
import json
|
||||||
|
import asyncio.futures
|
||||||
|
|
||||||
from .version import __version__
|
from .version import __version__
|
||||||
from .config import Config
|
from .config import Config
|
||||||
@ -47,7 +48,10 @@ class CrashReport:
|
|||||||
"url": request.path,
|
"url": request.path,
|
||||||
"data": request.json,
|
"data": request.json,
|
||||||
})
|
})
|
||||||
|
try:
|
||||||
self._client.captureException()
|
self._client.captureException()
|
||||||
|
except asyncio.futures.TimeoutError:
|
||||||
|
pass # We don't care if we can send the bug report
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def instance(cls):
|
def instance(cls):
|
||||||
|
@ -136,6 +136,11 @@ class Route(object):
|
|||||||
response = Response(route=route)
|
response = Response(route=route)
|
||||||
response.set_status(409)
|
response.set_status(409)
|
||||||
response.json({"message": str(e), "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:
|
except Exception as e:
|
||||||
log.error("Uncaught exception detected: {type}".format(type=type(e)), exc_info=1)
|
log.error("Uncaught exception detected: {type}".format(type=type(e)), exc_info=1)
|
||||||
response = Response(route=route)
|
response = Response(route=route)
|
||||||
|
Loading…
Reference in New Issue
Block a user