From bce6463d17f326ff4fd3cff51bfb1d547ac9f991 Mon Sep 17 00:00:00 2001 From: Terrtia Date: Tue, 20 Jul 2021 11:15:52 +0200 Subject: [PATCH] fix: [abstract_modules + Global] log message on error + fix Global exception on invalid gzip --- bin/modules/Global.py | 6 +++--- bin/modules/abstract_module.py | 1 + 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/bin/modules/Global.py b/bin/modules/Global.py index ff14051c..1fb237ac 100755 --- a/bin/modules/Global.py +++ b/bin/modules/Global.py @@ -109,7 +109,7 @@ class Global(AbstractModule): else: # Decode compressed base64 decoded = base64.standard_b64decode(gzip64encoded) - new_file_content = self.gunzip_bytes_obj(decoded) + new_file_content = self.gunzip_bytes_obj(filename, decoded) if new_file_content: filename = self.check_filename(filename, new_file_content) @@ -208,8 +208,8 @@ class Global(AbstractModule): return curr_file_content - - def gunzip_bytes_obj(self, bytes_obj): + # # TODO: add stats incomplete_file/Not a gzipped file + def gunzip_bytes_obj(self, filename, bytes_obj): gunzipped_bytes_obj = None try: in_ = io.BytesIO() diff --git a/bin/modules/abstract_module.py b/bin/modules/abstract_module.py index 2acb4d09..de38faa2 100644 --- a/bin/modules/abstract_module.py +++ b/bin/modules/abstract_module.py @@ -90,6 +90,7 @@ class AbstractModule(ABC): except Exception as err: trace = traceback.format_tb(err.__traceback__) self.redis_logger.critical(f"Error in module {self.module_name}: {err}") + self.redis_logger.critical(f"Module {self.module_name} input message: {message}") self.redis_logger.critical(trace) print() print(f"ERROR: {err}")