mirror of
https://github.com/ading2210/libcurl.js.git
synced 2025-05-13 14:30:02 -04:00
expose function to get error strings
This commit is contained in:
parent
15179fae43
commit
e211e8bf8c
5 changed files with 31 additions and 2 deletions
|
@ -244,6 +244,7 @@ api = {
|
|||
CurlWebSocket: CurlWebSocket,
|
||||
TLSSocket: TLSSocket,
|
||||
get_cacert: get_cacert,
|
||||
get_error_string: get_error_str,
|
||||
|
||||
wisp_connections: _wisp_connections,
|
||||
WispConnection: WispConnection,
|
||||
|
|
|
@ -106,6 +106,7 @@ class CurlWebSocket {
|
|||
this.connected = false;
|
||||
|
||||
if (error) {
|
||||
error_msg(`Websocket "${this.url}" encountered error code ${error}: ${get_error_str(error)}`);
|
||||
this.onerror(error);
|
||||
}
|
||||
else {
|
||||
|
|
|
@ -44,7 +44,6 @@ class FakeWebSocket extends EventTarget {
|
|||
|
||||
this.socket.onerror = (error) => {
|
||||
this.status = this.CLOSED;
|
||||
error_msg(`websocket ${this.url} encountered an error (${error})`);
|
||||
let error_event = new Event("error");
|
||||
this.dispatchEvent(error_event);
|
||||
this.onerror(error_event);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue