Skip to content

Commit

Permalink
fix(ws): Log server emitted errors to the console
Browse files Browse the repository at this point in the history
  • Loading branch information
enisdenjo committed Oct 27, 2021
1 parent 50620df commit 0826b0a
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/use/ws.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,12 @@ export function useServer<
const server = makeServer(options);

ws.on('error', (err) => {
console.error(
'Internal error emitted on the WebSocket server. ' +
'Please check your implementation.',
err,
);

// catch the first thrown error and re-throw it once all clients have been notified
let firstErr: Error | null = null;

Expand Down

0 comments on commit 0826b0a

Please sign in to comment.