[lib.domain] check if an HTTPException is raised, else raise an HTTPException(500)
This commit is contained in:
parent
15d69efd60
commit
a14285475e
|
@ -62,6 +62,12 @@ def route_decorator(fct: FunctionType, ret_type: str = 'json') -> Coroutine:
|
||||||
return ORJSONResponse(fct(**fct_args))
|
return ORJSONResponse(fct(**fct_args))
|
||||||
except NotImplementedError as exc:
|
except NotImplementedError as exc:
|
||||||
raise HTTPException(501) from exc
|
raise HTTPException(501) from exc
|
||||||
|
except Exception as exc:
|
||||||
|
# TODO: Write tests
|
||||||
|
if not isinstance(exc, HTTPException):
|
||||||
|
raise HTTPException(500)
|
||||||
|
raise exc
|
||||||
|
|
||||||
|
|
||||||
else:
|
else:
|
||||||
raise Exception('Return type not available')
|
raise Exception('Return type not available')
|
||||||
|
|
Loading…
Reference in New Issue