From b9abbd5cbd43a180c99b52a8963f073bafe1eb67 Mon Sep 17 00:00:00 2001 From: ChengLei Shao Date: Mon, 11 Sep 2023 15:45:30 +0800 Subject: [PATCH] fix(gateway): throw error when run from cli (#2627) * fix: throw error when run from cli * chore: log error --- packages/core/server/src/gateway/index.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/packages/core/server/src/gateway/index.ts b/packages/core/server/src/gateway/index.ts index 6e0016c09..91d8c0181 100644 --- a/packages/core/server/src/gateway/index.ts +++ b/packages/core/server/src/gateway/index.ts @@ -215,7 +215,15 @@ export class Gateway extends EventEmitter { } const mainApp = AppSupervisor.getInstance().bootMainApp(options.mainAppOptions); - mainApp.runAsCLI(); + + mainApp + .runAsCLI(process.argv, { + throwError: true, + from: 'node', + }) + .catch((e) => { + console.error(e); + }); } isStart() {