Skip to content

Commit

Permalink
[#69136] signal: Better error handling
Browse files Browse the repository at this point in the history
  • Loading branch information
MaciejWas committed Nov 22, 2024
1 parent 57e77c4 commit 5e61c53
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion bin/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,13 @@ export const setupWSConnection = async (conn, req, { docName = req.url.slice(1).
// get doc, initialize if it does not exist yet
const docPromise = getYDoc(docName, gc);

conn.on("message", /** @param {ArrayBuffer} message */ (message) => docPromise.then((doc) => messageListener(conn, doc, new Uint8Array(message))));
conn.on(
"message",
/** @param {ArrayBuffer} message */ (message) =>
docPromise.then((doc) => {
if (doc) messageListener(conn, doc, new Uint8Array(message));
}),
);

const doc = await docPromise;
if (!doc) {
Expand Down

0 comments on commit 5e61c53

Please sign in to comment.