Error loading exclusion lists exits early without write #267
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Purpose and background context
Why these changes are being introduced:
If there are any errors loading an exclusion list for a source, e.g. the file is not accessible or not parseable, we want the transformation process to fail completely without writes to the TIMDEX dataset.
As-is, we found that all records from the run will write to the dataset but with
action="error". This is good when some records fails to understand what they were and why, but an exclusion list error will fail for all records making this not helpful.How this addresses that need:
A new custom exception
CriticalErroris introduced that when raised will break theTransformer.__next__()iterator. In turn, this will bubble up to the CLI level and terminate the run with a non-zero process.This provides a mechanism from within a Transformer's transformation logic to raise an exception that will break the
Transformer.__next__ iteration.Side effects:
How can a reviewer manually see the effects of these changes?
1- Copy a fixture to use as an input file:
2- Run transform with an exclusion list that doesn't exist:
3- Check exit code:
Note the CLI process terminates with a non-zero exit code, and a clear reason why:
This will stop the StepFunction at this stage and not move on to future steps.
Includes new or updated dependencies?
YES | NO
Changes expectations for external applications?
NO
What are the relevant tickets?
Code review