Skip to content

Commit

Permalink
fix: error should be returned as a Promise.rejection
Browse files Browse the repository at this point in the history
  • Loading branch information
wa0x6e committed Sep 19, 2023
1 parent ec0586a commit a8c8ca2
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,6 @@ async function sendRequest(url: string, options: any) {
try {
return (await fetch(url, options)).result;
} catch (e: any) {
return { error: e.data?.error || { code: e.status, message: e.statusText } };
return Promise.reject({ error: e.data?.error || { code: e.status, message: e.statusText } });
}
}

0 comments on commit a8c8ca2

Please sign in to comment.