Skip to content

Commit

Permalink
feat: fix fetch error handling
Browse files Browse the repository at this point in the history
  • Loading branch information
lennybakkalian committed Dec 24, 2024
1 parent a8d4359 commit 72ed51c
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions projects/ngx-trpc/src/lib/utils/fetch.middleware.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,8 @@ export class FetchMiddleware {
console.log('[ngx-trpc] fetch', input);
}

const r = await fetch(input, init).catch((e) => {
if (this._config.debug) {
console.error('[ngx-trpc] fetch error', e);
}
return e;
});
const r = await fetch(input, init);

if (
this._response &&
this._response.headers &&
Expand All @@ -75,7 +71,7 @@ export class FetchMiddleware {
return r;
} catch (e) {
if (this._config.debug) {
console.error('[ngx-trpc] fetch middleware error', e);
console.error('[ngx-trpc] fetch middleware error', e, {url: input});
}
throw e;
}
Expand Down

0 comments on commit 72ed51c

Please sign in to comment.