Skip to content

Commit f6f6938

Browse files
committed
cleanup
1 parent fbc6446 commit f6f6938

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

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

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,11 @@
3131
from .typing_extension import Handler, Middleware
3232

3333
DEFAULT_API_VERSION = "v0"
34-
FMSG_INTERNAL_ERROR_USER_FRIENDLY = "We apologize for the inconvenience. Our team has recorded the issue and is working to resolve it as quickly as possible. Thank you for your patience [{}]"
34+
_FMSG_INTERNAL_ERROR_USER_FRIENDLY = (
35+
"We apologize for the inconvenience."
36+
" Our team has recorded the issue [{error_code}] and is working to resolve it as quickly as possible."
37+
" Thank you for your patience"
38+
)
3539

3640

3741
_logger = logging.getLogger(__name__)
@@ -58,7 +62,7 @@ def _process_and_raise_unexpected_error(request: web.BaseRequest, err: Exception
5862
if isinstance(err, OsparcErrorMixin):
5963
error_context.update(err.error_context())
6064

61-
frontend_msg = FMSG_INTERNAL_ERROR_USER_FRIENDLY.format(error_code)
65+
frontend_msg = _FMSG_INTERNAL_ERROR_USER_FRIENDLY.format(error_code)
6266
log_msg = create_troubleshotting_log_message(
6367
message_to_user=frontend_msg,
6468
error=err,

packages/service-library/tests/aiohttp/test_rest_middlewares.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
from models_library.utils.json_serialization import json_dumps
1717
from servicelib.aiohttp import status
1818
from servicelib.aiohttp.rest_middlewares import (
19-
FMSG_INTERNAL_ERROR_USER_FRIENDLY,
19+
_FMSG_INTERNAL_ERROR_USER_FRIENDLY,
2020
envelope_middleware_factory,
2121
error_middleware_factory,
2222
)
@@ -238,7 +238,10 @@ async def test_raised_unhandled_exception(
238238
# user friendly message with OEC reference
239239
assert "OEC" in error["message"]
240240
parsed_oec = parse_error_code(error["message"]).pop()
241-
assert FMSG_INTERNAL_ERROR_USER_FRIENDLY.format(parsed_oec) == error["message"]
241+
assert (
242+
_FMSG_INTERNAL_ERROR_USER_FRIENDLY.format(error_code=parsed_oec)
243+
== error["message"]
244+
)
242245

243246
# avoids details
244247
assert not error.get("errors")

0 commit comments

Comments
 (0)