Skip to content

Commit

Permalink
Fix handling of CriticalInputError exceptions (#514)
Browse files Browse the repository at this point in the history
* Fix handling CriticalInputError
* update Changelog

---------

Co-authored-by: ekneg54 <[email protected]>
  • Loading branch information
clumsy9 and ekneg54 authored Jan 30, 2024
1 parent f1b8545 commit 54623b2
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
### Bugfix

* make the s3 connector actually use the `max_retries` parameter
* fixed a bug which leads to a `FatalOutputError` on handling `CriticalInputError` in pipeline

## v9.0.3
### Breaking
Expand Down
2 changes: 1 addition & 1 deletion logprep/framework/pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ def _inner(self: "Pipeline") -> Any:
self.logger.error(str(error))
self.stop()
except CriticalInputError as error:
if raw_input := error.raw_input and self._output: # pylint: disable=protected-access
if (raw_input := error.raw_input) and self._output: # pylint: disable=protected-access
for _, output in self._output.items(): # pylint: disable=protected-access
if output.default:
output.store_failed(str(self), raw_input, {})
Expand Down
3 changes: 3 additions & 0 deletions tests/unit/framework/test_pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,9 @@ def raise_critical(timeout):
str(CriticalInputError(self.pipeline._input, "mock input error", input_event))
)
assert self.pipeline._output["dummy"].store_failed.call_count == 1, "one error is stored"
self.pipeline._output["dummy"].store_failed.assert_called_with(
str(self.pipeline), input_event, {}
)
assert self.pipeline._output["dummy"].store.call_count == 0, "no event is stored"

@mock.patch("logging.Logger.warning")
Expand Down

0 comments on commit 54623b2

Please sign in to comment.