Skip to content
Source
Sign inSign up
TanStack/form
Open History to see the last commit

error.ts

27 lines737 Bytes

1import type {
2 FormAsyncValidateOrFn,
3 ServerFormState,
4} from '@tanstack/react-form'
5​
6interface ServerValidateErrorState<
7 TFormData,
8 TOnServer extends undefined | FormAsyncValidateOrFn<TFormData>,
9> {
10 formState: ServerFormState<TFormData, TOnServer>
12​
13export class ServerValidateError<
14 TFormData,
15 TOnServer extends undefined | FormAsyncValidateOrFn<TFormData>,
17 extends Error
18 implements ServerValidateErrorState<TFormData, TOnServer>
20 formState: ServerFormState<TFormData, TOnServer>
21​
22 constructor(options: ServerValidateErrorState<TFormData, TOnServer>) {
23 super('Your form has errors. Please check the fields and try again.')
24 this.name = 'ServerValidateError'
25 this.formState = options.formState
26 }