diff --git a/packages/react-native/Libraries/WebSocket/WebSocket.js b/packages/react-native/Libraries/WebSocket/WebSocket.js index 36aafbbbab17..01c991a152f5 100644 --- a/packages/react-native/Libraries/WebSocket/WebSocket.js +++ b/packages/react-native/Libraries/WebSocket/WebSocket.js @@ -181,7 +181,9 @@ class WebSocket extends EventTarget { send(data: string | ArrayBuffer | ArrayBufferView | Blob): void { if (this.readyState === this.CONNECTING) { - throw new Error('INVALID_STATE_ERR'); + throw new Error( + "Failed to execute 'send' on 'WebSocket': Still in CONNECTING state", + ); } if (data instanceof Blob) { @@ -208,7 +210,9 @@ class WebSocket extends EventTarget { ping(): void { if (this.readyState === this.CONNECTING) { - throw new Error('INVALID_STATE_ERR'); + throw new Error( + "Failed to execute 'ping' on 'WebSocket': Still in CONNECTING state", + ); } NativeWebSocketModule.ping(this._socketId);