mirror of
https://github.com/ail-project/ail-framework.git
synced 2024-11-14 02:28:23 +00:00
fix: [abstract_modules + Global] log message on error + fix Global exception on invalid gzip
This commit is contained in:
parent
6ade3b85dc
commit
bce6463d17
2 changed files with 4 additions and 3 deletions
|
@ -109,7 +109,7 @@ class Global(AbstractModule):
|
||||||
else:
|
else:
|
||||||
# Decode compressed base64
|
# Decode compressed base64
|
||||||
decoded = base64.standard_b64decode(gzip64encoded)
|
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:
|
if new_file_content:
|
||||||
filename = self.check_filename(filename, new_file_content)
|
filename = self.check_filename(filename, new_file_content)
|
||||||
|
@ -208,8 +208,8 @@ class Global(AbstractModule):
|
||||||
|
|
||||||
return curr_file_content
|
return curr_file_content
|
||||||
|
|
||||||
|
# # TODO: add stats incomplete_file/Not a gzipped file
|
||||||
def gunzip_bytes_obj(self, bytes_obj):
|
def gunzip_bytes_obj(self, filename, bytes_obj):
|
||||||
gunzipped_bytes_obj = None
|
gunzipped_bytes_obj = None
|
||||||
try:
|
try:
|
||||||
in_ = io.BytesIO()
|
in_ = io.BytesIO()
|
||||||
|
|
|
@ -90,6 +90,7 @@ class AbstractModule(ABC):
|
||||||
except Exception as err:
|
except Exception as err:
|
||||||
trace = traceback.format_tb(err.__traceback__)
|
trace = traceback.format_tb(err.__traceback__)
|
||||||
self.redis_logger.critical(f"Error in module {self.module_name}: {err}")
|
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)
|
self.redis_logger.critical(trace)
|
||||||
print()
|
print()
|
||||||
print(f"ERROR: {err}")
|
print(f"ERROR: {err}")
|
||||||
|
|
Loading…
Reference in a new issue