Skip to content

Commit 79d42ad

Browse files
committed
@GitHK review: msessage
1 parent 9467860 commit 79d42ad

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

services/storage/tests/unit/test_utils_handlers.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99

1010
import httpx
1111
import pytest
12-
from asyncpg import PostgresError
1312
from aws_library.s3._errors import S3AccessError, S3KeyNotFoundError
1413
from fastapi import FastAPI, HTTPException, status
1514
from fastapi.exceptions import RequestValidationError
@@ -28,6 +27,7 @@
2827
DatcoreAdapterTimeoutError,
2928
)
3029
from simcore_service_storage.modules.db.access_layer import InvalidFileIdentifierError
30+
from sqlalchemy.exc import DBAPIError
3131

3232

3333
@pytest.fixture
@@ -85,7 +85,12 @@ async def client(initialized_app: FastAPI) -> AsyncIterator[AsyncClient]:
8585
status.HTTP_422_UNPROCESSABLE_ENTITY,
8686
),
8787
(
88-
PostgresError("pytest postgres error"),
88+
DBAPIError.instance(
89+
statement="pytest statement",
90+
params={},
91+
orig=Exception("pytest original"),
92+
dbapi_base_err=Exception("pytest dbapi base error"),
93+
),
8994
status.HTTP_503_SERVICE_UNAVAILABLE,
9095
),
9196
(

services/web/server/src/simcore_service_webserver/security/_authz_policy.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ def _handle_exceptions_as_503():
5050
except DatabaseError as err:
5151
_logger.exception(
5252
**create_troubleshooting_log_kwargs(
53-
MSG_AUTH_NOT_AVAILABLE + ": Auth unavailable due to database error.",
53+
f"{MSG_AUTH_NOT_AVAILABLE}: Auth unavailable due to database error.",
5454
error=err,
5555
error_context={"origin": str(err.orig) if err.orig else None},
5656
tip="Check database connection",

0 commit comments

Comments
 (0)