Skip to content

Commit

Permalink
fix: fetch error detection
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexXanderGrib authored Mar 6, 2024
1 parent 9eca262 commit d8a3728
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/client/links.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { type FetchEsque } from '@trpc/client/dist/internals/types'
function customFetch(input: RequestInfo | URL, init?: RequestInit & { method: 'GET' }) {
return globalThis.$fetch.raw(input.toString(), init)
.catch((e) => {
if (e.constructor.name === 'FetchError' && e.response) { return e.response }
if (e instanceof Error && e.name === 'FetchError' && e.response) { return e.response }
throw e
})
.then(response => ({
Expand Down

0 comments on commit d8a3728

Please sign in to comment.