Skip to content

Commit 997261d

Browse files
committed
fix: throw validator error with normalized issues
1 parent 2571504 commit 997261d

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

packages/react-start-client/src/createServerFn.ts

+5-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { default as invariant } from 'tiny-invariant'
22
import { default as warning } from 'tiny-warning'
33
import { isNotFound, isRedirect } from '@tanstack/react-router'
4+
import { normalizeValidatorIssues } from '@tanstack/router-core'
45
import { mergeHeaders } from './headers'
56
import { globalMiddleware } from './registerGlobalMiddleware'
67
import { startSerializer } from './serializer'
@@ -802,8 +803,10 @@ function execValidator(validator: AnyValidator, input: unknown): unknown {
802803
if (result instanceof Promise)
803804
throw new Error('Async validation not supported')
804805

805-
if (result.issues)
806-
throw new Error(JSON.stringify(result.issues, undefined, 2))
806+
if (result.issues) {
807+
const issues = normalizeValidatorIssues(result.issues)
808+
throw new Error(JSON.stringify(issues, undefined, 2))
809+
}
807810

808811
return result.value
809812
}

0 commit comments

Comments
 (0)