Skip to content

Commit

Permalink
chore: show ws port conflict error (#8209)
Browse files Browse the repository at this point in the history
  • Loading branch information
sapphi-red authored May 18, 2022
1 parent 9df59ed commit c86329b
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion packages/vite/src/node/server/ws.ts
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,12 @@ export function createWebSocketServer(
})

wss.on('error', (e: Error & { code: string }) => {
if (e.code !== 'EADDRINUSE') {
if (e.code === 'EADDRINUSE') {
config.logger.error(
colors.red(`WebSocket server error: Port is already in use`),
{ error: e }
)
} else {
config.logger.error(
colors.red(`WebSocket server error:\n${e.stack || e.message}`),
{ error: e }
Expand Down

0 comments on commit c86329b

Please sign in to comment.