diff --git a/src/index.ts b/src/index.ts index 55ac635..d710f5d 100644 --- a/src/index.ts +++ b/src/index.ts @@ -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 } }); } }