From 6352802a3d724108fff12efd523434395c6d1c34 Mon Sep 17 00:00:00 2001 From: Andrey Lushnikov Date: Wed, 12 Feb 2020 16:35:39 -0800 Subject: [PATCH 1/2] fix(platform): properly handle websocket error events --- src/platform.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/platform.ts b/src/platform.ts index 6f935b1c24aee..41111f5451e14 100644 --- a/src/platform.ts +++ b/src/platform.ts @@ -325,7 +325,7 @@ export class WebSocketTransport implements ConnectionTransport { }) : new WebSocket(url)) as WebSocket; this._connect = new Promise((fulfill, reject) => { this._ws.addEventListener('open', () => fulfill()); - this._ws.addEventListener('error', event => reject(new Error(event.toString()))); + this._ws.addEventListener('error', event => reject(new Error('WebSocket error: ' + event.message))); }); // The 'ws' module in node sometimes sends us multiple messages in a single task. // In Web, all IO callbacks (e.g. WebSocket callbacks) From 0c567d10474c4397fb71e011cda8938d4b6025ab Mon Sep 17 00:00:00 2001 From: Andrey Lushnikov Date: Wed, 12 Feb 2020 16:44:10 -0800 Subject: [PATCH 2/2] fix lint --- src/platform.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/platform.ts b/src/platform.ts index 41111f5451e14..b4c0fea7baade 100644 --- a/src/platform.ts +++ b/src/platform.ts @@ -325,7 +325,7 @@ export class WebSocketTransport implements ConnectionTransport { }) : new WebSocket(url)) as WebSocket; this._connect = new Promise((fulfill, reject) => { this._ws.addEventListener('open', () => fulfill()); - this._ws.addEventListener('error', event => reject(new Error('WebSocket error: ' + event.message))); + this._ws.addEventListener('error', event => reject(new Error('WebSocket error: ' + (event as ErrorEvent).message))); }); // The 'ws' module in node sometimes sends us multiple messages in a single task. // In Web, all IO callbacks (e.g. WebSocket callbacks)