fix: [abstract_modules + Global] log message on error + fix Global exception on invalid gzip

This commit is contained in:
Terrtia 2021-07-20 11:15:52 +02:00
parent 6ade3b85dc
commit bce6463d17
No known key found for this signature in database
GPG key ID: 1E1B1F50D84613D0
2 changed files with 4 additions and 3 deletions

View file

@ -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()

View file

@ -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}")