From 789045c372b48be5cace569521c4898e4cb5ea6c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A4=9C=E9=B9=B0?= <17kungfuboy@gmail.com> Date: Fri, 9 Sep 2022 11:40:00 +0800 Subject: [PATCH] feat: catch ws connect error --- src/workbench/node/server/main.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/workbench/node/server/main.js b/src/workbench/node/server/main.js index 5f694bf12..d616e57f8 100644 --- a/src/workbench/node/server/main.js +++ b/src/workbench/node/server/main.js @@ -85,6 +85,9 @@ io.on('connection', (socket) => { {} ), }); + ws.on('error', (err) => { + socket.emit('ws-client', { type: 'ws-connect-back', status: -1, content: err }); + }); } catch (error) { socket.emit('ws-client', { type: 'ws-connect-back', status: -1, content: error }); ws = null;