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

Use new CJsonException instead of ApiClientException

parent 1a33ee03
No related branches found
No related tags found
No related merge requests found
...@@ -11,6 +11,7 @@ from api.authentication import is_moderator ...@@ -11,6 +11,7 @@ from api.authentication import is_moderator
from api.miscellaneous import * from api.miscellaneous import *
from api.version import get_api_path, API_LATEST_VERSION, API_OLDEST_ACTIVE_VERSION from api.version import get_api_path, API_LATEST_VERSION, API_OLDEST_ACTIVE_VERSION
from videoag_common.database.database import TransactionConflictError from videoag_common.database.database import TransactionConflictError
from videoag_common.miscellaneous.json import CJsonException
_API_GLOBAL_RATE_LIMITERS = create_configured_host_rate_limiters("global", api.config["API_GLOBAL_RATE_LIMIT"]) _API_GLOBAL_RATE_LIMITERS = create_configured_host_rate_limiters("global", api.config["API_GLOBAL_RATE_LIMIT"])
_DEFAULT_CACHE_CONTROL_MAX_AGE_SECONDS = api.config["DEFAULT_CACHE_CONTROL_MAX_AGE_SECONDS"] _DEFAULT_CACHE_CONTROL_MAX_AGE_SECONDS = api.config["DEFAULT_CACHE_CONTROL_MAX_AGE_SECONDS"]
...@@ -388,6 +389,8 @@ def api_function(track_in_diagnostics: bool = True, ...@@ -388,6 +389,8 @@ def api_function(track_in_diagnostics: bool = True,
return ApiResponse(result[0], result[1]).build_response() return ApiResponse(result[0], result[1]).build_response()
else: # pragma: no cover else: # pragma: no cover
raise Exception(f"Api route {truncate_string(request.path)} returned result of unknown type: {str(result)}") raise Exception(f"Api route {truncate_string(request.path)} returned result of unknown type: {str(result)}")
except CJsonException as e:
return api_on_error(ERROR_REQUEST_INVALID_PARAMETER(e.path, e.message))
except ApiClientException as e: except ApiClientException as e:
return api_on_error(e.error) return api_on_error(e.error)
except TransactionConflictError as e: except TransactionConflictError as e:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment