unjs / ofetch

😱 A better fetch API. Works on node, browser and workers.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to customize triggering errors

zss1004504439 opened this issue · comments

commented

ofetch/src/fetch.ts

Lines 277 to 286 in 411904d

if (
!context.options.ignoreResponseError &&
context.response.status >= 400 &&
context.response.status < 600
) {
if (context.options.onResponseError) {
await context.options.onResponseError(context as any);
}
return await onError(context);
}