neume-network / core

A socially-scalable music NFT indexer.
https://neume.network
GNU General Public License v3.0
26 stars 11 forks source link

force close the app when an error bubbles up #85

Closed il3ven closed 2 years ago

il3ven commented 2 years ago

If the control flow reaches here then there isn't anything else to execute. But the process won't exit because worker is still running. So, we force close using process.exit().

TimDaub commented 2 years ago

btw do we even need this try catch? What if we just allow all errors from await boot to throw?

il3ven commented 2 years ago

btw do we even need this try catch? What if we just allow all errors from await boot to throw?

I tried this approach and the problem remains the same. Since, it is an async function we get UnhandledPromiseRejectionWarning and the program doesn't exit.

Note: In Node 16 we will not get aUnhandledPromiseRejectionWarning and the application will crash as you expect. https://nodejs.org/dist/latest/docs/api/deprecations.html#dep0018-unhandled-promise-rejections

TimDaub commented 2 years ago

https://github.com/neume-network/strategies/pull/272#issuecomment-124125230

I briefly checked node 15.0.0 and 16.0.0 release log and I couldn't find any major upgrade we'd have to make in our code.

il3ven commented 2 years ago

Closing in favour of neume-network/core#88