File tree 1 file changed +6
-3
lines changed
services/api-server/src/simcore_service_api_server/exceptions
1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change 44
44
45
45
class ToApiTuple (NamedTuple ):
46
46
status_code : ApiHTTPStatus
47
- detail : Callable [[Any ], str ] | str | None
47
+ detail : Callable [[Any ], str ] | str | None = None
48
48
49
49
50
50
# service to public-api status maps
@@ -60,13 +60,16 @@ def _get_http_exception_kwargs(
60
60
detail : str = ""
61
61
headers : dict [str , str ] = {}
62
62
63
- if in_api := http_status_map .get (service_error .response .status_code ):
64
- detail = f"{ service_error } ."
63
+ if mapped := http_status_map .get (service_error .response .status_code ):
64
+ in_api = ToApiTuple (* mapped )
65
+ status_code = in_api .status_code
65
66
if in_api .detail :
66
67
if callable (in_api .detail ):
67
68
detail = f"{ in_api .detail (detail_kwargs )} ."
68
69
else :
69
70
detail = in_api .detail
71
+ else :
72
+ detail = f"{ service_error } ."
70
73
71
74
elif service_error .response .status_code in {
72
75
status .HTTP_429_TOO_MANY_REQUESTS ,
You can’t perform that action at this time.
0 commit comments