Skip to content

Commit e9ab4e6

Browse files
committed
fixes messages errors
1 parent 9903c16 commit e9ab4e6

File tree

4 files changed

+8
-8
lines changed

4 files changed

+8
-8
lines changed

packages/service-library/src/servicelib/logging_errors.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,10 @@ def _collect_causes(exc: BaseException) -> str:
3939
debug_data = json_dumps(
4040
{
4141
"exception_type": f"{type(error)}",
42-
"exception_details": f"{error}",
42+
"exception_string": f"{error}",
43+
"exception_causes": _collect_causes(error),
4344
"error_code": error_code,
4445
"context": error_context,
45-
"causes": _collect_causes(error),
4646
"tip": tip,
4747
},
4848
default=representation_encoder,

services/web/server/src/simcore_service_webserver/login/_controller/rest/change.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -150,9 +150,9 @@ def _get_error_context(
150150
# do not want to forward but rather log due to the special rules in this entrypoint
151151
_logger.warning(
152152
**create_troubleshotting_log_kwargs(
153-
f"{_error_msg_prefix} for invalid user. {_error_msg_suffix}.",
153+
f"{_error_msg_prefix} for invalid user. {err.text}. {_error_msg_suffix}",
154154
error=err,
155-
error_context=_get_error_context(user),
155+
error_context={**_get_error_context(user), "error.text": err.text},
156156
)
157157
)
158158
ok = False
@@ -168,7 +168,7 @@ def _get_error_context(
168168
):
169169
_logger.warning(
170170
**create_troubleshotting_log_kwargs(
171-
f"{_error_msg_prefix} for a user with NO access to this product. {_error_msg_suffix}.",
171+
f"{_error_msg_prefix} for a user with NO access to this product. {_error_msg_suffix}",
172172
error=Exception("User cannot access this product"),
173173
error_context=_get_error_context(user),
174174
)

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
from models_library.users import UserID
77

88
from ._authz_access_model import AuthContextDict, OptionalContext
9-
from ._constants import PERMISSION_PRODUCT_LOGIN_KEY
9+
from ._constants import MSG_UNAUTHORIZED, PERMISSION_PRODUCT_LOGIN_KEY
1010

1111
assert PERMISSION_PRODUCT_LOGIN_KEY # nosec
1212

@@ -28,7 +28,7 @@ async def check_user_authorized(request: web.Request) -> UserID:
2828
# NOTE: Same as aiohttp_security.api.check_authorized
2929
user_id: UserID | None = await aiohttp_security.api.authorized_userid(request)
3030
if user_id is None:
31-
raise web.HTTPUnauthorized
31+
raise web.HTTPUnauthorized(text=MSG_UNAUTHORIZED)
3232
return user_id
3333

3434

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
from typing import Final
22

33
MSG_AUTH_NOT_AVAILABLE: Final[str] = "Authentication service is temporary unavailable"
4-
4+
MSG_UNAUTHORIZED: Final[str] = "Unauthorized"
55
PERMISSION_PRODUCT_LOGIN_KEY: Final[str] = "product.login"

0 commit comments

Comments
 (0)