disqus4u Latest Questions

Can I make nodejs terminate on unhandled promise rejections?

Elijah .W

It looks like there is a bug in the code which causes an error like this:

DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

How can you fix this kind of error? Can NodeJS terminate when this error happens?




  1. This error can be fixed using the following:

    process.on('unhandledRejection', error => {
        throw error;






Leave an answer

Leave an answer