Skip to content

Commit 79384bb

Browse files
author
Andrei Neagu
committed
fixed exception handler
1 parent 1a3999c commit 79384bb

File tree

2 files changed

+4
-2
lines changed
  • packages/service-library/src/servicelib/fastapi
  • services/dynamic-scheduler/src/simcore_service_dynamic_scheduler/api/rest

2 files changed

+4
-2
lines changed

packages/service-library/src/servicelib/fastapi/exceptions_utils.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,11 @@
1515

1616

1717
async def http_exception_as_json_response(
18-
request: Request, exc: HTTPException
18+
request: Request, exc: Exception
1919
) -> JSONResponse:
20+
assert isinstance(exc, HTTPException) # nosec
2021
assert request # nosec
22+
2123
error = DefaultApiError.from_status_code(exc.status_code)
2224

2325
error_detail = error.detail or ""

services/dynamic-scheduler/src/simcore_service_dynamic_scheduler/api/rest/routes.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,4 @@ def setup_rest_api(app: FastAPI):
1616
app.include_router(api_router)
1717

1818
app.add_exception_handler(Exception, handle_errors_as_500)
19-
app.add_exception_handler(HTTPException, http_exception_as_json_response) # type: ignore[arg-type]
19+
app.add_exception_handler(HTTPException, http_exception_as_json_response)

0 commit comments

Comments
 (0)