mirror of
https://github.com/GNS3/gns3-server
synced 2024-12-01 04:38:12 +00:00
Return proper JSON error when something goes wrong on any endpoint
This commit is contained in:
parent
f68c1f0bde
commit
ff4fc5eb8b
@ -231,7 +231,6 @@ class ProjectHandler:
|
||||
controller = Controller.instance()
|
||||
project = controller.get_project(request.match_info["project_id"])
|
||||
|
||||
|
||||
started = False
|
||||
|
||||
for data in project.export(include_images=bool(request.GET.get("include_images", "0"))):
|
||||
|
@ -161,15 +161,15 @@ class Route(object):
|
||||
if response:
|
||||
return response
|
||||
|
||||
# Non API call
|
||||
if api_version is None or raw is True:
|
||||
response = Response(request=request, route=route, output_schema=output_schema)
|
||||
|
||||
yield from func(request, response)
|
||||
return response
|
||||
|
||||
# API call
|
||||
try:
|
||||
# Non API call
|
||||
if api_version is None or raw is True:
|
||||
response = Response(request=request, route=route, output_schema=output_schema)
|
||||
|
||||
yield from func(request, response)
|
||||
return response
|
||||
|
||||
# API call
|
||||
if "controller" in func.__module__ and server_config.getboolean("controller", False) is False:
|
||||
raise aiohttp.web.HTTPForbidden(text="The server is not a controller")
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user