From 6493b4a027f45739e5a55b8c881b94acdf47bcc8 Mon Sep 17 00:00:00 2001 From: Kyle Villegas <86266231+kylevillegas93@users.noreply.github.com> Date: Fri, 8 Nov 2024 14:45:21 -0500 Subject: [PATCH] NO-REF: add error handling error process init (#437) --- main.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/main.py b/main.py index d9ddd9d38e..637dc0e212 100644 --- a/main.py +++ b/main.py @@ -36,10 +36,14 @@ def main(args): availableProcesses = registerProcesses() - procClass = availableProcesses[process] - processInstance = procClass( - procType, customFile, startDate, singleRecord, limit, offset, options - ) + try: + procClass = availableProcesses[process] + processInstance = procClass( + procType, customFile, startDate, singleRecord, limit, offset, options + ) + except: + logger.exception(f'Failed to initialize process {process} in {environment}') + return if process in ( "APIProcess", # Covered by newrelic's automatic Flask integration @@ -50,6 +54,7 @@ def main(args): else: app = newrelic.agent.register_application(timeout=10.0) with newrelic.agent.BackgroundTask(app, name=process): + logger.info(f'Running process {process} in {environment}') processInstance.runProcess()