Skip to content

Commit

Permalink
fix: improve error handling for WebsocketServer (#5038)
Browse files Browse the repository at this point in the history
  • Loading branch information
snitin315 committed Feb 2, 2024
1 parent 48f56d5 commit 975c719
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions lib/servers/WebsocketServer.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,17 @@ module.exports = class WebsocketServer extends BaseServer {
client.on("close", () => {
this.clients.splice(this.clients.indexOf(client), 1);
});

// TODO: add a test case for this - https://github.com/webpack/webpack-dev-server/issues/5018
client.on(
"error",
/**
* @param {Error} err
*/
(err) => {
this.server.logger.error(err.message);
},
);
},
);

Expand Down

0 comments on commit 975c719

Please sign in to comment.