throw error objects instead of plain strings, update wisp server

This commit is contained in:
ading2210 2024-10-02 12:30:48 -04:00
parent 3c1a942501
commit c1b78e1d0c
11 changed files with 16 additions and 15 deletions

View file

@ -67,13 +67,13 @@ class HTTPSession extends CurlSession {
}
if (error > 0) {
error_msg(`Request "${url}" failed with error code ${error}: ${get_error_str(error)}`);
reject(`Request failed with error code ${error}: ${get_error_str(error)}`);
reject(new TypeError(`Request failed with error code ${error}: ${get_error_str(error)}`));
}
else if (error === -1) {
reject(new DOMException("The operation was aborted."));
}
else if (error === -2) {
reject("Request failed because redirects were disallowed.");
reject(new TypeError("Request failed because redirects were disallowed."));
}
this.remove_request(http_handle);
http_handle = null;