Skip to content

Commit

Permalink
Merge pull request #159 from AlexXanderGrib/patch-1
Browse files Browse the repository at this point in the history
fix: fetch error detection
  • Loading branch information
wobsoriano authored Mar 6, 2024
2 parents 9eca262 + d8a3728 commit f65fb63
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 f65fb63

Please sign in to comment.