Skip to content

Commit d3c8eb4

Browse files
committed
document custom on fail
1 parent 9dfa0db commit d3c8eb4

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

docs/how_to_guides/custom_validators.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ Validators ship with several out of the box `on_fail` policies. The `OnFailActio
7575
| `OnFailAction.NOOP` | Do nothing. The failure will still be recorded in the logs, but no corrective action will be taken. |
7676
| `OnFailAction.EXCEPTION` | Raise an exception when validation fails. |
7777
| `OnFailAction.FIX_REASK` | First, fix the generated output deterministically, and then rerun validation with the deterministically fixed output. If validation fails, then perform reasking. |
78+
| `OnFailAction.CUSTOM` | This action is set internally when the validator is passed a custom function to handle failures. The function is called with the value that failed validation and the FailResult returned from the Validator. i.e. the custom on fail handler must implement the method signature `def on_fail(value: Any, fail_result: FailResult) -> Any` |
7879

7980
In the code below, a `fix_value` will be supplied in the `FailResult`. This value will represent a programmatic fix that can be applied to the output if `on_fail='fix'` is passed during validator initialization.
8081
```py

0 commit comments

Comments
 (0)