Skip to content

Commit

Permalink
Allow uncaught errors to propagate
Browse files Browse the repository at this point in the history
  • Loading branch information
Mike committed Sep 27, 2022
1 parent 57a951c commit d661e49
Showing 1 changed file with 3 additions and 10 deletions.
13 changes: 3 additions & 10 deletions src/hdx/utilities/errors_onexit.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,18 +41,11 @@ def exit_on_error(self) -> None:
if self.errors:
sys.exit(1)

def log_exit_on_error(self) -> None:
"""Log errors and exit with a 1 code if there are errors
Returns:
None
"""
self.log()
self.exit_on_error()

def __enter__(self) -> "ErrorsOnExit":
logging.errors_on_exit = self
return self

def __exit__(self, exc_type: Any, exc_value: Any, traceback: Any) -> None:
self.log_exit_on_error()
self.log()
if exc_type is None:
self.exit_on_error()

0 comments on commit d661e49

Please sign in to comment.