nestjs / nest

A progressive Node.js framework for building efficient, scalable, and enterprise-grade server-side applications with TypeScript/JavaScript 🚀
https://nestjs.com
MIT License
66.89k stars 7.56k forks source link

When OnModuleInit exec failed, should stop running. #914

Closed XGHeaven closed 6 years ago

XGHeaven commented 6 years ago

I'm submitting a...


[ ] Regression 
[ ] Bug report
[x] Feature request
[ ] Documentation issue or request

Current behavior

export class SomeService implements OnModuleInit {
  async onModuleInit() {
    throw new Error('should stop')
  }
}

When I running, a error occured, server process don't stop.

Expected behavior

server process should stop when any of onModuleInit called failed.

What is the motivation / use case for changing the behavior?

When running in docker, server cannot start correctly because onModuleInit called failed. The server process still alived. And docker think it still running. It's wrong.

Environment


Nest version: 5.1.0


For Tooling issues:
- Node version: 10.7.0  
- Platform: Mac             
kamilmysliwiec commented 6 years ago

Fixed in 5.2.0

XGHeaven commented 6 years ago

Sorry, I can't found a commit relative with this issue.

kamilmysliwiec commented 6 years ago

5.2.0 is here! Let me know if you face any issue

lock[bot] commented 4 years ago

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.