Skip to content

Commit

Permalink
NO-REF: add error handling error process init (#437)
Browse files Browse the repository at this point in the history
  • Loading branch information
kylevillegas93 authored Nov 8, 2024
1 parent af95c3d commit 6493b4a
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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()


Expand Down

0 comments on commit 6493b4a

Please sign in to comment.