We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent faca4d3 commit 2087bd3Copy full SHA for 2087bd3
packages/vscode-ws-jsonrpc/src/socket/reader.ts
@@ -60,8 +60,16 @@ export class WebSocketMessageReader extends AbstractMessageReader implements Mes
60
if (this.state === 'initial') {
61
this.events.splice(0, 0, { message });
62
} else if (this.state === 'listening') {
63
- const data = JSON.parse(message);
64
- this.callback!(data);
+ try {
+ const data = JSON.parse(message);
65
+ this.callback!(data);
66
+ } catch (err) {
67
+ const error: Error = {
68
+ name: '' + 400,
69
+ message: `Error during message parsing, reason = ${typeof err === 'object' ? (err as any).message : 'unknown'}`
70
+ };
71
+ this.fireError(error);
72
+ }
73
}
74
75
0 commit comments