Skip to content

Commit 921d69f

Browse files
author
Andrei Neagu
committed
catching unexpected cases
1 parent c5723af commit 921d69f

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

services/storage/src/simcore_service_storage/api/rpc/_async_jobs.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
JobNotDoneError,
2020
JobSchedulerError,
2121
)
22+
from servicelib.logging_utils import log_catch
2223
from servicelib.rabbitmq import RPCRouter
2324

2425
from ...modules.celery import get_celery_client
@@ -96,9 +97,14 @@ async def result(
9697
raise JobAbortedError(job_id=job_id)
9798
if _status.task_state == TaskState.ERROR:
9899
# NOTE: recover original error from wrapped error
99-
exception = pickle.loads(base64.b64decode(_result.args[0]))
100-
exc_type = type(exception).__name__
101-
exc_msg = f"{exception}"
100+
exception = None
101+
exc_type = None
102+
exc_msg = f"{_result}" # try to deseialise something
103+
104+
with log_catch(_logger, reraise=False):
105+
exception = pickle.loads(base64.b64decode(_result.args[0]))
106+
exc_type = type(exception).__name__
107+
exc_msg = f"{exception}"
102108
raise JobError(job_id=job_id, exc_type=exc_type, exc_msg=exc_msg, exc=exception)
103109

104110
return AsyncJobResult(result=_result)

0 commit comments

Comments
 (0)