DataCleaner
DataCleaner copied to clipboard
Make a "soft" validation error
Currently, we only have "hard" validation failures, which essentially makes the job building stop, so that e.g. output datastreams does not exist yet. We'll need some way to make more "soft" validation errors which doesn't break the job building, but just disallows execution.
A way would be to allow @Validate
annotated methods to have multiple signatures, one of them being the current void
as return type (for backwards compatibility), the other being one of;
- A simple boolean,
true
being validated successfully, false being a failed validation (soft). - Some kind of a
ValidationError
class, with a reason and a level, like ValidationError.WARNING, ValidationError.EXECUTION and ValidationError.HARD (or BUILD, since hard errors would stop the building, like all does now). - Like 2, but with an array of
ValidationError
.
In all cases, throwing any exception is the same as a hard validation error.
I think that 1. might be too simplistic, so I'd prefer 2 or 3. That also makes it possible to show custom messages in the UI. 2. has the advantage of simplicity, 3. of flexibility and over time allowing the UI to show all problems from the beginning.