File tree Expand file tree Collapse file tree 4 files changed +8
-8
lines changed
packages/service-library/src/servicelib
services/web/server/src/simcore_service_webserver Expand file tree Collapse file tree 4 files changed +8
-8
lines changed Original file line number Diff line number Diff 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 ,
Original file line number Diff line number Diff 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 )
Original file line number Diff line number Diff line change 66from models_library .users import UserID
77
88from ._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
1111assert 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
Original file line number Diff line number Diff line change 11from typing import Final
22
33MSG_AUTH_NOT_AVAILABLE : Final [str ] = "Authentication service is temporary unavailable"
4-
4+ MSG_UNAUTHORIZED : Final [ str ] = "Unauthorized"
55PERMISSION_PRODUCT_LOGIN_KEY : Final [str ] = "product.login"
You can’t perform that action at this time.
0 commit comments