Skip to content

Commit 4e4eb47

Browse files
committed
cleanup
1 parent cf4b04b commit 4e4eb47

File tree

3 files changed

+11
-12
lines changed

3 files changed

+11
-12
lines changed

packages/service-library/src/servicelib/aiohttp/rest_middlewares.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ def _process_and_raise_unexpected_error(request: web.BaseRequest, err: Exception
7070
)
7171
_logger.exception(
7272
**create_troubleshotting_log_kwargs(
73-
error_user_msg=frontend_msg,
73+
user_error_msg=frontend_msg,
7474
error=err,
7575
error_context=error_context,
7676
)

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

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212

1313
def create_troubleshotting_log_message(
14-
error_user_msg: str,
14+
user_error_msg: str,
1515
*,
1616
error: BaseException,
1717
error_code: ErrorCodeStr,
@@ -21,7 +21,7 @@ def create_troubleshotting_log_message(
2121
"""Create a formatted message for _logger.exception(...)
2222
2323
Arguments:
24-
error_user_msg -- A user-friendly message to be displayed on the front-end explaining the issue in simple terms.
24+
user_error_msg -- A user-friendly message to be displayed on the front-end explaining the issue in simple terms.
2525
error -- the instance of the handled exception
2626
error_code -- A unique error code (e.g., OEC or osparc-specific) to identify the type or source of the error for easier tracking.
2727
error_context -- Additional context surrounding the exception, such as environment variables or function-specific data. This can be derived from exc.error_context() (relevant when using the OsparcErrorMixin)
@@ -38,7 +38,7 @@ def create_troubleshotting_log_message(
3838
indent=1,
3939
)
4040

41-
return f"{error_user_msg}.\n{debug_data}"
41+
return f"{user_error_msg}.\n{debug_data}"
4242

4343

4444
class LogKwargs(TypedDict):
@@ -47,8 +47,7 @@ class LogKwargs(TypedDict):
4747

4848

4949
def create_troubleshotting_log_kwargs(
50-
error_user_msg: str,
51-
*,
50+
user_error_msg: str,
5251
error: BaseException,
5352
error_context: dict[str, Any] | None = None,
5453
tip: str | None = None,
@@ -63,7 +62,7 @@ def create_troubleshotting_log_kwargs(
6362
except MyException as exc
6463
_logger.exception(
6564
**create_troubleshotting_log_kwargs(
66-
error_user_msg=frontend_msg,
65+
user_error_msg=frontend_msg,
6766
exception=exc,
6867
tip="Check row in `groups_extra_properties` for this product. It might be missing.",
6968
)
@@ -78,9 +77,9 @@ def create_troubleshotting_log_kwargs(
7877
if isinstance(error, OsparcErrorMixin):
7978
context.update(error.error_context())
8079

81-
# aggregate
80+
# compose as log message
8281
log_msg = create_troubleshotting_log_message(
83-
error_user_msg=error_user_msg,
82+
user_error_msg,
8483
error=error,
8584
error_code=error_code,
8685
error_context=context,

services/web/server/src/simcore_service_webserver/users/_handlers.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,17 +49,17 @@ async def wrapper(request: web.Request) -> web.StreamResponse:
4949
except UserNotFoundError as exc:
5050
raise web.HTTPNotFound(reason=f"{exc}") from exc
5151
except MissingGroupExtraPropertiesForProductError as exc:
52-
frontend_msg = FMSG_MISSING_CONFIG_WITH_OEC.format(
52+
user_error_msg = FMSG_MISSING_CONFIG_WITH_OEC.format(
5353
error_code=exc.error_code()
5454
)
5555
_logger.exception(
5656
**create_troubleshotting_log_kwargs(
57-
error_user_msg=frontend_msg,
57+
user_error_msg,
5858
error=exc,
5959
tip="Row in `groups_extra_properties` for this product is missing.",
6060
)
6161
)
62-
raise web.HTTPServiceUnavailable(reason=frontend_msg) from exc
62+
raise web.HTTPServiceUnavailable(reason=user_error_msg) from exc
6363

6464
return wrapper
6565

0 commit comments

Comments
 (0)