From c7cc03ed627fe22a37d51abeb8878cf51ccd634a Mon Sep 17 00:00:00 2001 From: Rachel Wegener Date: Thu, 8 Feb 2024 15:49:53 +0000 Subject: [PATCH] fix syntax error found while testing --- icepyx/core/is2ref.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/icepyx/core/is2ref.py b/icepyx/core/is2ref.py index c51c631be..66ceaec1c 100644 --- a/icepyx/core/is2ref.py +++ b/icepyx/core/is2ref.py @@ -378,8 +378,10 @@ def extract_product(filepath, auth=None): # ATL14 saves the short_name as an array ['ATL14'] product = product[0] product = _validate_product(product) - except KeyError: - raise "Unable to parse the product name from file metadata" + except KeyError as e: + raise Exception( + "Unable to parse the product name from file metadata" + ).with_traceback(e.__traceback__) # Close the file reader f.close() @@ -421,8 +423,10 @@ def extract_version(filepath, auth=None): if isinstance(version, bytes): version = version.decode() - except KeyError: - raise "Unable to parse the version from file metadata" + except KeyError as e: + raise Exception( + "Unable to parse the version from file metadata" + ).with_traceback(e.__traceback__) # Close the file reader f.close()