diff options
Diffstat (limited to 'packages/lsp/src/client.ts')
| -rw-r--r-- | packages/lsp/src/client.ts | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/packages/lsp/src/client.ts b/packages/lsp/src/client.ts index 743fcb4..677a22a 100644 --- a/packages/lsp/src/client.ts +++ b/packages/lsp/src/client.ts @@ -175,7 +175,11 @@ export class LanguageServerClient { private handleBytes(chunk: Uint8Array): void { const messages = this.decoder.decode(chunk); for (const msg of messages) { - this.rpc?.handleMessage(msg); + // handleMessage is async — catch rejections so a malformed + // message never becomes an unhandled rejection that crashes + // the server. (handleMessage also has its own try/catch around + // JSON.parse, but this is the defence-in-depth boundary.) + void this.rpc?.handleMessage(msg).catch(() => {}); } } |
