Skip to content

Commit

Permalink
Serialize error before sending it to the worker
Browse files Browse the repository at this point in the history
  • Loading branch information
clauderic committed Jan 20, 2025
1 parent ccc0c95 commit 5207ece
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/safari-dataclone-error.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@shopify/codemirror-language-client': patch
---

Fix `DataCloneError` on Safari by serializing the `ResponseError` before sending it to the worker.
2 changes: 1 addition & 1 deletion packages/codemirror-language-client/src/LanguageClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ export class LanguageClient extends EventTarget implements AbstractLanguageClien
private sendResponse(id: number | string, result: any, error?: ResponseError) {
const response: ResponseMessage = { jsonrpc: '2.0', id };
if (result !== undefined) response.result = result;
if (error !== undefined) response.error = error;
if (error !== undefined) response.error = error.toJson();
this.log(`Client->Server response [${id}]`, response);
this.sendMessage(response);
}
Expand Down

0 comments on commit 5207ece

Please sign in to comment.