From 649a0fb2ddb141a5412fc4afa8acd3f2ebd32cdc Mon Sep 17 00:00:00 2001 From: Mike Lang Date: Tue, 20 Aug 2024 12:00:26 +1000 Subject: [PATCH] cutter: Improve error message for unhandled cutting exceptions In particular, use exception chaining instead of printing the old error. --- cutter/cutter/main.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cutter/cutter/main.py b/cutter/cutter/main.py index 4aabeb3..225edc2 100644 --- a/cutter/cutter/main.py +++ b/cutter/cutter/main.py @@ -428,8 +428,8 @@ class Cutter(object): yield chunk except Exception as ex: self.logger.exception("Error occurred while trying to cut job {}".format(format_job(job))) - # Assumed error is not retryable - raise UploadError("Error while cutting: {}".format(ex), retryable=False) + # Assumed error is not retryable. Exception chaining preserves original error message. + raise UploadError("Unhandled exception while cutting", retryable=False) from ex # The data is now fully uploaded, but the request is not finalized. # We now set the DB state to finalized so we know about failures during this