Skip to content

Commit

Permalink
Restructure exception handling
Browse files Browse the repository at this point in the history
  • Loading branch information
delucchi-cmu committed Nov 29, 2023
1 parent 2da502c commit 0b77517
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/hipscat_import/pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,15 +55,15 @@ def pipeline_with_client(args: RuntimeArguments, client: Client):
macauff_runner.run(args, client)
else:
raise ValueError("unknown args type")
except Exception as exception: # pylint: disable=broad-exception-caught
_send_failure_email(args, exception)
else:

_send_success_email(args)
except Exception as exception: # pylint: disable=broad-exception-caught
if args.completion_email_address:
_send_failure_email(args, exception)
raise exception


def _send_failure_email(args: RuntimeArguments, exception: Exception):
if not args.completion_email_address:
raise exception from None
message = EmailMessage()
message["Subject"] = "hipscat-import failure."
message["To"] = args.completion_email_address
Expand Down

0 comments on commit 0b77517

Please sign in to comment.