From 17bf070844aea6433a3ac050d68cfc07bfa07c8c Mon Sep 17 00:00:00 2001 From: mcarans Date: Tue, 14 Jan 2025 15:37:41 +1300 Subject: [PATCH] Change default to False for should_exit_on_error --- src/hdx/utilities/error_handler.py | 4 ++-- tests/hdx/utilities/test_error_handler.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/hdx/utilities/error_handler.py b/src/hdx/utilities/error_handler.py index 1bed5d4..230b73e 100644 --- a/src/hdx/utilities/error_handler.py +++ b/src/hdx/utilities/error_handler.py @@ -18,13 +18,13 @@ class ErrorHandler: sorted. Args: - should_exit_on_error (bool): Whether to exit with a 1 code if there are errors. Default is True. + should_exit_on_error (bool): Whether to exit with a 1 code if there are errors. Default is False. """ def __init__( self, - should_exit_on_error: bool = True, + should_exit_on_error: bool = False, ): self.should_exit_on_error = should_exit_on_error self.shared_errors = { diff --git a/tests/hdx/utilities/test_error_handler.py b/tests/hdx/utilities/test_error_handler.py index 3e8e18f..ccf7c5e 100755 --- a/tests/hdx/utilities/test_error_handler.py +++ b/tests/hdx/utilities/test_error_handler.py @@ -17,7 +17,7 @@ def test_error_handler(self, caplog): assert len(errors.shared_errors["error"]) == 0 with pytest.raises(SystemExit): with caplog.at_level(logging.ERROR): - with ErrorHandler() as errors: + with ErrorHandler(should_exit_on_error=True) as errors: errors.add("this is a error!") errors.add("this is a warning!", "warning 1", "warning") errors.add_missing_value(