In this article, we would like to show you how to exit from program in Node.js.
Default value of the
0and means success.
process module provides
exit() method that allows you to programmatically exit from a Node.js program.
When Node.js executes the method, the process is immediately forced to terminate, which means that any callback function that's pending, any request still being sent, processes writing etc. is going to be ungracefully terminated right away.
You can pass an integer that signals the operating system the exit code:
The default value of the
exit code is
0 and means success.
Any different exit codes have different meaning which you might want to use in your system.
Uncaught Fatal Exception: There was an uncaught exception, and it was not handled by a domain or an 'uncaughtException' event handler.