diff --git a/packages/core/server/src/application.ts b/packages/core/server/src/application.ts index de37b866c0..27d79e4401 100644 --- a/packages/core/server/src/application.ts +++ b/packages/core/server/src/application.ts @@ -188,14 +188,23 @@ export class Application exten if (options?.listen?.port) { const listen = () => - new Promise((resolve) => { + new Promise((resolve, reject) => { const Server = this.listen(options?.listen, () => { resolve(Server); }); + + Server.on('error', (err) => { + reject(err); + }); }); - // @ts-ignore - this.listenServer = await listen(); + try { + //@ts-ignore + this.listenServer = await listen(); + } catch (e) { + console.error(e); + process.exit(1); + } } await this.emitAsync('afterStart', this, options);