diff --git a/README.md b/README.md index 8f94d49..ed26439 100644 --- a/README.md +++ b/README.md @@ -377,8 +377,8 @@ ws.on('close', () => { }); // Listen to raw error events. Recommended. -ws.on('error', (err) => { - console.error('error', err); +ws.on('exception', (err) => { + console.error('exception', err); }); ws.on('reconnect', ({ wsKey }) => { diff --git a/examples/ws-api-events.ts b/examples/ws-api-events.ts index 8e3a9c9..ce47005 100644 --- a/examples/ws-api-events.ts +++ b/examples/ws-api-events.ts @@ -69,8 +69,8 @@ async function main() { const CANCEL_AFTER_SECONDS = 5; // Exceptions including rejected commands will show here (as well as the catch handler used below) - wsClient.on('error', (data) => { - console.error('ws error: ', data); + wsClient.on('exception', (data) => { + console.error('ws exception: ', data); }); // Replies to commands will show here diff --git a/examples/ws-private-v5.ts b/examples/ws-private-v5.ts index f9a4f1a..f7d91e6 100644 --- a/examples/ws-private-v5.ts +++ b/examples/ws-private-v5.ts @@ -49,7 +49,7 @@ wsClient.on('reconnect', ({ wsKey }) => { wsClient.on('reconnected', (data) => { console.log('ws has reconnected ', data?.wsKey); }); -// wsClient.on('error', (data) => { +// wsClient.on('exception', (data) => { // console.error('ws exception: ', data); // }); diff --git a/test/ws.util.ts b/test/ws.util.ts index db82eee..8e48777 100644 --- a/test/ws.util.ts +++ b/test/ws.util.ts @@ -21,7 +21,7 @@ export type WsClientEvent = | 'open' | 'update' | 'close' - | 'error' + | 'exception' | 'reconnect' | 'reconnected' | 'response'; @@ -46,7 +46,7 @@ export function waitForSocketEvent( clearTimeout(timeout); resolvedOnce = true; wsClient.removeListener(event, (e) => resolver(e)); - wsClient.removeListener('error', (e) => rejector(e)); + wsClient.removeListener('exception', (e) => rejector(e)); } function resolver(event) {