Skip to content

Commit

Permalink
Fix error messages
Browse files Browse the repository at this point in the history
  • Loading branch information
ryo-ma committed Jul 8, 2020
1 parent 10a1954 commit 839d843
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions lib/websocket.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,15 +104,15 @@ 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);
}
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);
Expand Down
2 changes: 1 addition & 1 deletion test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ Deno.test(
const connection = on(wss, "connection");
await assertThrowsAsync(async (): Promise<void> => {
await ws1.send("message");
}, WebSocketError);
}, WebSocketError, "WebSocket is not open: state 0 (CONNECTING)");

await connection.next();
await wss.close();
Expand Down

0 comments on commit 839d843

Please sign in to comment.