Skip to content
Snippets Groups Projects
Commit c46dc7ab authored by Simon Künzel's avatar Simon Künzel
Browse files

Add server name to errors, Closes #25

parent 4440e200
No related branches found
No related tags found
1 merge request!1Rollout to production
Pipeline #5922 passed
import json import json
from flask.wrappers import Response from flask.wrappers import Response
import api
from api.miscellaneous.constants import * from api.miscellaneous.constants import *
_SERVER_NAME = api.config["API_SERVER_NAME"]
class ApiError: class ApiError:
...@@ -21,7 +24,8 @@ class ApiClientException(Exception): ...@@ -21,7 +24,8 @@ class ApiClientException(Exception):
def api_on_error(error: ApiError): def api_on_error(error: ApiError):
error_json = { error_json = {
"error_code": error.error_code, "error_code": error.error_code,
"message": error.message "message": error.message,
"server": _SERVER_NAME
} }
return Response(json.dumps(error_json), error.http_status_code, mimetype="application/json") return Response(json.dumps(error_json), error.http_status_code, mimetype="application/json")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment