Skip to content

Commit

Permalink
Added a flag to raise errors to help with debugging
Browse files Browse the repository at this point in the history
  • Loading branch information
rbnswartz committed Jan 17, 2025
1 parent bc0c5ef commit 08ceb1e
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions listener.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ def listen_for_messages():
if not connstr:
logger.error("No Service Bus connection string found")
exit(1)
raise_errors = os.environ.get("DEBUG_RAISE_ERRORS", "False")
renewer = AutoLockRenewer()
with ServiceBusClient.from_connection_string(connstr) as client:
with client.get_subscription_receiver(topicName, subscriptionName, uamqp_transport=True) as receiver:
Expand Down Expand Up @@ -149,6 +150,8 @@ def listen_for_messages():
receiver.dead_letter_message(message, reason=f"Error scanning {user}/{repo}", error_description=str(e))
logger.error(f"Error scanning {user}/{repo}: {e}", stack_info=True)
success = False
if raise_errors == "True":
raise e
finally:
shutil.rmtree(tempdir)
if not success:
Expand Down

0 comments on commit 08ceb1e

Please sign in to comment.