Skip to content

Commit 0ed05f6

Browse files
committed
Do not nest SearchParamError in itself
1 parent 4388a97 commit 0ed05f6

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

packages/react-router/src/router.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1263,9 +1263,12 @@ export class Router<
12631263
undefined,
12641264
]
12651265
} catch (err: any) {
1266-
const searchParamError = new SearchParamError(err.message, {
1267-
cause: err,
1268-
})
1266+
let searchParamError = err
1267+
if (!(err instanceof SearchParamError)) {
1268+
searchParamError = new SearchParamError(err.message, {
1269+
cause: err,
1270+
})
1271+
}
12691272

12701273
if (opts?.throwOnError) {
12711274
throw searchParamError

0 commit comments

Comments
 (0)