Skip to content

Commit

Permalink
chore(website): add throwValidationErrors documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
TheEdoRan committed Jun 20, 2024
1 parent 8abcf33 commit 4a4acd0
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion website/docs/safe-action-client/initialization-options.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,4 +115,8 @@ export const actionClient = createSafeActionClient({
// By default all actions will return validation errors in the `flattened` shape.
defaultValidationErrorsShape: "flattened",
});
```
```

## `throwValidationErrors?`

You can provide this optional boolean property to `createSafeActionClient` to change the default behavior of what happens when validation errors occur during action execution. When this option is set to `true`, the action will throw a `ActionValidationError` with the related validation errors in a `validationErrors` property. This option also works for server validation errors set with [`returnValidationErrors`](/docs/recipes/additional-validation-errors#returnvalidationerrors) function. The errors shape respects the `defaultValidationErrorsShape` option or the overridden one set in [`schema`](/docs/safe-action-client/instance-methods#schema) using the optional [`handleValidationErrorsShape`](/docs/recipes/customize-validation-errors-format) function. The default value is `false`.

0 comments on commit 4a4acd0

Please sign in to comment.