From d4bcb9af65148308915835b65a173a0361c33ae8 Mon Sep 17 00:00:00 2001 From: Carlos Lopez Date: Sat, 27 Jun 2020 13:59:04 -0600 Subject: [PATCH] Proper error handling in csv/dumps for approvals --- crc/services/approval_service.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/crc/services/approval_service.py b/crc/services/approval_service.py index eacac72c..e0cd5412 100644 --- a/crc/services/approval_service.py +++ b/crc/services/approval_service.py @@ -1,5 +1,6 @@ import json import pickle +import sys from base64 import b64decode from datetime import datetime, timedelta @@ -194,7 +195,7 @@ class ApprovalService(object): health_attesting_rows.append(record) except Exception as e: - app.logger.error("Error pulling data for workflow #%i: %s" % (approval.workflow_id, str(e))) + app.logger.error(f'Error pulling data for workflow {approval.workflow_id}', exc_info=True) return health_attesting_rows @@ -222,7 +223,13 @@ class ApprovalService(object): output.append(record) except Exception as e: - errors.append("Error pulling data for workflow #%i: %s" % (approval.workflow_id, str(e))) + errors.append( + f'Error pulling data for workflow #{approval.workflow_id} ' + f'(Approval status: {approval.status} - ' + f'More details in Sentry): {str(e)}' + ) + # Detailed information sent to Sentry + app.logger.error(f'Error pulling data for workflow {approval.workflow_id}', exc_info=True) return {"results": output, "errors": errors } @staticmethod