Skip to content

Commit ccb9458

Browse files
fix: better error handling msg
1 parent 654714f commit ccb9458

File tree

3 files changed

+11
-3
lines changed

3 files changed

+11
-3
lines changed

packages/celery-library/src/celery_library/errors.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,4 @@ def decode_celery_transferrable_error(error: TransferrableCeleryError) -> Except
2727

2828

2929
class TaskNotFoundError(OsparcErrorMixin, Exception):
30-
msg_template = "Task with id '{task_id}' not found"
30+
msg_template = "Task with id '{task_id}' was not found"

services/api-server/src/simcore_service_api_server/_constants.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,8 @@
1010
"Something went wrong on our end. We've been notified and will resolve this issue as soon as possible. Thank you for your patience.",
1111
_version=2,
1212
)
13+
14+
MSG_CLIENT_ERROR_USER_FRIENDLY_TEMPLATE: Final[str] = user_message(
15+
"Something went wrong with your request.",
16+
_version=1,
17+
)

services/api-server/src/simcore_service_api_server/exceptions/handlers/__init__.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,10 @@
99
from starlette import status
1010
from starlette.exceptions import HTTPException
1111

12-
from ..._constants import MSG_INTERNAL_ERROR_USER_FRIENDLY_TEMPLATE
12+
from ..._constants import (
13+
MSG_CLIENT_ERROR_USER_FRIENDLY_TEMPLATE,
14+
MSG_INTERNAL_ERROR_USER_FRIENDLY_TEMPLATE,
15+
)
1316
from ...exceptions.backend_errors import BaseBackEndError
1417
from ..custom_errors import CustomBaseError
1518
from ..log_streaming_errors import LogStreamingBaseError
@@ -47,7 +50,7 @@ def setup(app: FastAPI, *, is_debug: bool = False):
4750
make_handler_for_exception(
4851
TaskNotFoundError,
4952
status.HTTP_404_NOT_FOUND,
50-
error_message="The requested task was not found",
53+
error_message=MSG_CLIENT_ERROR_USER_FRIENDLY_TEMPLATE,
5154
add_exception_to_message=True,
5255
),
5356
)

0 commit comments

Comments
 (0)