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) => {
reject(error);
request.onerror = () => {
reject(new Error("001 Connection aborted"));
};
request.send(bufferContent || content);

View File

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