Refactor tests and start work on database integration.

This commit is contained in:
grossmj
2020-12-02 18:39:08 +10:30
parent ae55c0ec9c
commit bf7cf862af
69 changed files with 2955 additions and 1877 deletions

View File

@ -30,6 +30,7 @@ from fastapi.responses import JSONResponse
from gns3server.controller.controller_error import (
ControllerError,
ControllerNotFoundError,
ControllerBadRequestError,
ControllerTimeoutError,
ControllerForbiddenError,
ControllerUnauthorizedError
@ -119,6 +120,15 @@ async def controller_not_found_error_handler(request: Request, exc: ControllerNo
)
@app.exception_handler(ControllerBadRequestError)
async def controller_bad_request_error_handler(request: Request, exc: ControllerBadRequestError):
log.error(f"Controller bad request error: {exc}")
return JSONResponse(
status_code=400,
content={"message": str(exc)},
)
# make sure the content key is "message", not "detail" per default
@app.exception_handler(StarletteHTTPException)
async def http_exception_handler(request: Request, exc: StarletteHTTPException):