File tree Expand file tree Collapse file tree 2 files changed +8
-6
lines changed
packages/service-library/src/servicelib
services/api-server/src/simcore_service_api_server/exceptions/handlers Expand file tree Collapse file tree 2 files changed +8
-6
lines changed Original file line number Diff line number Diff line change 22from pprint import pformat
33from typing import Any , NotRequired , TypedDict
44
5- from models_library .error_codes import ErrorCodeStr , create_error_code
5+ from models_library .error_codes import ErrorCodeStr
66from models_library .errors_classes import OsparcErrorMixin
77
88from .logging_utils import LogExtra , get_log_record_extra
@@ -48,7 +48,9 @@ class LogKwargs(TypedDict):
4848
4949def create_troubleshotting_log_kwargs (
5050 user_error_msg : str ,
51+ * ,
5152 error : BaseException ,
53+ error_code : ErrorCodeStr | None = None ,
5254 error_context : dict [str , Any ] | None = None ,
5355 tip : str | None = None ,
5456) -> LogKwargs :
@@ -69,9 +71,6 @@ def create_troubleshotting_log_kwargs(
6971 )
7072
7173 """
72- # error-code
73- error_code = create_error_code (error )
74-
7574 # error-context
7675 context = error_context or {}
7776 if isinstance (error , OsparcErrorMixin ):
Original file line number Diff line number Diff line change @@ -35,13 +35,16 @@ async def _http_error_handler(
3535 if add_exception_to_message :
3636 user_error_msg += f" { exception } "
3737
38+ error_code = create_error_code (exception )
3839 if add_oec_to_message :
39- error_code = create_error_code (exception )
4040 user_error_msg += f" [{ error_code } ]"
4141
4242 _logger .exception (
4343 ** create_troubleshotting_log_kwargs (
44- user_error_msg , error = exception , tip = "Unexpected error"
44+ user_error_msg ,
45+ error = exception ,
46+ error_code = error_code ,
47+ tip = "Unexpected error" ,
4548 )
4649 )
4750 return create_error_json_response (user_error_msg , status_code = status_code )
You can’t perform that action at this time.
0 commit comments