fix: network error object message

This commit is contained in:
Ramires Viana 2022-05-04 12:36:13 +00:00
parent 96afaca0ad
commit fc209f64de
2 changed files with 7 additions and 4 deletions

View File

@ -111,8 +111,8 @@ export async function post(url, content = "", overwrite = false, onupload) {
} }
}; };
request.onerror = (error) => { request.onerror = () => {
reject(error); reject(new Error("001 Connection aborted"));
}; };
request.send(bufferContent || content); request.send(bufferContent || content);

View File

@ -18,8 +18,11 @@ export async function fetchURL(url, opts) {
}, },
...rest, ...rest,
}); });
} catch (error) { } catch {
return { status: 0 }; const error = new Error("000 No connection");
error.status = 0;
throw error;
} }
if (res.headers.get("X-Renew-Token") === "true") { if (res.headers.get("X-Renew-Token") === "true") {