Skip to content

Commit aa0cd2f

Browse files
authored
🐛Director-v0: ensure error are enveloped too (#8081)
1 parent 7c68dc8 commit aa0cd2f

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

services/catalog/src/simcore_service_catalog/clients/director.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,9 @@ def _unenvelope_or_raise_error(
8282
"""
8383
body = resp.json()
8484

85-
assert "data" in body or "error" in body # nosec
85+
assert (
86+
"data" in body or "error" in body
87+
), f"here is the failing {body=}, {resp.request=}" # nosec
8688
data = body.get("data")
8789
error = body.get("error")
8890

@@ -250,7 +252,6 @@ async def get_service_extras(
250252
# discrete resources (custom made ones) ---
251253
# check if the service requires GPU support
252254
if not invalid_with_msg and _validate_kind(entry, "VRAM"):
253-
254255
result["node_requirements"]["GPU"] = 1
255256
if not invalid_with_msg and _validate_kind(entry, "MPI"):
256257
result["node_requirements"]["MPI"] = 1
@@ -282,7 +283,6 @@ async def get_service_extras(
282283
for dl, sl in _ORG_LABELS_TO_SCHEMA_LABELS.items()
283284
if dl in labels
284285
}:
285-
286286
result.update({"service_build_details": service_build_details})
287287

288288
return TypeAdapter(ServiceExtras).validate_python(result)

services/director/src/simcore_service_director/core/application.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
from fastapi import FastAPI
55
from servicelib.async_utils import cancel_sequential_workers
66
from servicelib.fastapi.client_session import setup_client_session
7+
from servicelib.fastapi.http_error import set_app_default_http_error_handlers
78
from servicelib.fastapi.tracing import (
89
initialize_fastapi_app_tracing,
910
setup_tracing,
@@ -73,6 +74,7 @@ def create_app(settings: ApplicationSettings) -> FastAPI:
7374
initialize_fastapi_app_tracing(app)
7475

7576
# ERROR HANDLERS
77+
set_app_default_http_error_handlers(app)
7678

7779
# EVENTS
7880
async def _on_startup() -> None:

0 commit comments

Comments
 (0)