From 5825fd6f36a59bc3cfd8e30042c38a1ec9501d95 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=89=8B=E7=93=9C=E4=B8=80=E5=8D=81=E9=9B=AA?= Date: Mon, 20 May 2024 12:35:50 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E6=8B=A6=E6=88=AA=E5=BC=82=E5=B8=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/common/server/http.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/common/server/http.ts b/src/common/server/http.ts index 8e70cabe..34ae7d48 100644 --- a/src/common/server/http.ts +++ b/src/common/server/http.ts @@ -58,6 +58,9 @@ export abstract class HttpServerBase { this.expressAPP.get('/', (req: Request, res: Response) => { res.send(`${this.name}已启动`); }); + this.expressAPP.on('error', (err) => { + logError('HTTP服务启动失败', err.toString()); + }); this.listen(port, host); } catch (e: any) { logError('HTTP服务启动失败', e.toString()); @@ -115,7 +118,7 @@ export abstract class HttpServerBase { const info = `${this.name} started ${host}:${port}`; log(info); }); - }catch (e: any) { + } catch (e: any) { logError('HTTP服务启动失败, 请检查监听的ip地址和端口', e.stack.toString()); } }