From 839d84351dead001fd898dce4eeead79391a4d61 Mon Sep 17 00:00:00 2001 From: ryo-ma Date: Wed, 8 Jul 2020 21:30:04 +0900 Subject: [PATCH] Fix error messages --- lib/websocket.ts | 4 ++-- test.ts | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/websocket.ts b/lib/websocket.ts index b5f7e8b..790f10a 100644 --- a/lib/websocket.ts +++ b/lib/websocket.ts @@ -104,7 +104,7 @@ export class WebSocket extends EventEmitter { async ping(message?: string | Uint8Array) { if (this.state === WebSocketState.CONNECTING) { throw new WebSocketError( - "WebSocket is not open: readyState 0 (CONNECTING)", + "WebSocket is not open: state 0 (CONNECTING)", ); } return this.webSocket!.ping(message); @@ -112,7 +112,7 @@ export class WebSocket extends EventEmitter { async send(message: string | Uint8Array) { if (this.state === WebSocketState.CONNECTING) { throw new WebSocketError( - "WebSocket is not open: readyState 0 (CONNECTING)", + "WebSocket is not open: state 0 (CONNECTING)", ); } return this.webSocket!.send(message); diff --git a/test.ts b/test.ts index 3d163d7..151a9ac 100644 --- a/test.ts +++ b/test.ts @@ -68,7 +68,7 @@ Deno.test( const connection = on(wss, "connection"); await assertThrowsAsync(async (): Promise => { await ws1.send("message"); - }, WebSocketError); + }, WebSocketError, "WebSocket is not open: state 0 (CONNECTING)"); await connection.next(); await wss.close();