fix: [ods_enrich] Better exception logging

pull/539/head
Jakub Onderka 2021-12-24 16:10:29 +01:00
parent c5801d1776
commit 3fe7072bfb
1 changed files with 2 additions and 2 deletions

View File

@ -4,6 +4,7 @@ import np
import ezodf
import pandas_ods_reader
import io
import logging
misperrors = {'error': 'Error'}
mispattributes = {'input': ['attachment'],
@ -37,11 +38,10 @@ def handler(q=False):
for i in range(0, num_sheets):
ods = pandas_ods_reader.read_ods(ods_file, i, headers=False)
ods_content = ods_content + "\n" + ods.to_string(max_rows=None)
print(ods_content)
return {'results': [{'types': ['freetext'], 'values': ods_content, 'comment': ".ods-to-text from file " + filename},
{'types': ['text'], 'values': ods_content, 'comment': ".ods-to-text from file " + filename}]}
except Exception as e:
print(e)
logging.exception(e)
err = "Couldn't analyze file as .ods. Error was: " + str(e)
misperrors['error'] = err
return misperrors