From 1286176faabb9b720aca4a31e25a3c8cd740663d Mon Sep 17 00:00:00 2001 From: Nelson Dominguez Date: Wed, 29 Nov 2023 16:05:22 +0100 Subject: [PATCH] style: explicitly re-raise execptions --- deepface/commons/functions.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/deepface/commons/functions.py b/deepface/commons/functions.py index 6ac90d3c..c9095f01 100644 --- a/deepface/commons/functions.py +++ b/deepface/commons/functions.py @@ -117,11 +117,11 @@ def load_image(img): img = cv2.imdecode(chunk_arr, cv2.IMREAD_COLOR) return img - except cv2.error: - raise ValueError(f"Image '{img}' contains invalid data") + except cv2.error as exc: + raise ValueError(f"Image '{img}' contains invalid data") from exc - except Exception as e: - raise e + except Exception as exc: + raise exc # This causes troubles when reading files with non english names # return cv2.imread(img)