Skip to content

Commit 642fda5

Browse files
committed
fix
1 parent b11b8dd commit 642fda5

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

services/api-server/src/simcore_service_api_server/exceptions/service_errors_utils.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444

4545
class ToApiTuple(NamedTuple):
4646
status_code: ApiHTTPStatus
47-
detail: Callable[[Any], str] | str | None
47+
detail: Callable[[Any], str] | str | None = None
4848

4949

5050
# service to public-api status maps
@@ -60,13 +60,16 @@ def _get_http_exception_kwargs(
6060
detail: str = ""
6161
headers: dict[str, str] = {}
6262

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
6566
if in_api.detail:
6667
if callable(in_api.detail):
6768
detail = f"{in_api.detail(detail_kwargs)}."
6869
else:
6970
detail = in_api.detail
71+
else:
72+
detail = f"{service_error}."
7073

7174
elif service_error.response.status_code in {
7275
status.HTTP_429_TOO_MANY_REQUESTS,

0 commit comments

Comments
 (0)