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

error.ts

21 lines589 Bytes

1import type { ServerFormState } from './types'
2​
3interface ServerValidateErrorState<TFormData> {
4 formState: ServerFormState<TFormData>
5 response: Response
6}
7​
8export class ServerValidateError<TFormData>
9 extends Error
10 implements ServerValidateErrorState<TFormData>
12 response: Response
13 formState: ServerFormState<TFormData>
14​
15 constructor(options: ServerValidateErrorState<TFormData>) {
16 super('Your form has errors. Please check the fields and try again.')
17 this.name = 'ServerValidateError'
18 this.response = options.response
19 this.formState = options.formState
20 }