Skip to content

Commit

Permalink
error_email wrapper
Browse files Browse the repository at this point in the history
  • Loading branch information
deanm0000 committed Jul 31, 2024
1 parent 341eefa commit 250caf4
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/dean_utils/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,20 @@
)
from dean_utils.utils.email_utility import send_email, az_send
from dean_utils.polars_extras import pl_scan_hive, pl_scan_pq, pl_write_pq


def error_email(func):
def wrapper(*args, **kwargs):
try:
return func(*args, **kwargs)
except Exception as err:
import os
import inspect
from traceback import format_exception

az_send(
os.getcwd(),
"\n".join(inspect.stack()) + "\n\n" + "\n".join(format_exception(err)),
)

return wrapper

0 comments on commit 250caf4

Please sign in to comment.