From d2ccc4778a597b501440f0b62f32ca48c44cc328 Mon Sep 17 00:00:00 2001 From: Arnaud Date: Wed, 19 Feb 2025 09:38:19 +0100 Subject: [PATCH] Avoid swallowing CancelledError --- codex/rest/api.nim | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/codex/rest/api.nim b/codex/rest/api.nim index 4d9df011..b0f23b5b 100644 --- a/codex/rest/api.nim +++ b/codex/rest/api.nim @@ -69,10 +69,11 @@ proc getLongestRequestEnd( return success(0.SecondsSince1970) return success(requestEnds.max) - except CancelledError, CatchableError: - error "Error when trying to get longest request end", - error = getCurrentExceptionMsg() - return failure("Cannot retrieve the request dates") + except CancelledError as err: + raise err + except CatchableError as err: + error "Error when trying to get longest request end", error = err.msg + return failure("Cannot retrieve the request dates: " & err.msg) proc validate(pattern: string, value: string): int {.gcsafe, raises: [Defect].} = 0