![]() |
VOOZH | about |
The process.setUncaughtExceptionCaptureCallback() method is an inbuilt application programming interface of the processing module which is used to set a callback function which will be called when an Uncaught Exception occurs. The callback function will receive the exception value as its first argument.
Syntax:
process.setUncaughtExceptionCaptureCallback( callback_function )
Parameters: This method accepts a single parameter as mentioned above and described below.
Return: It does not return any value.
Below examples illustrate the use of process.setUncaughtExceptionCaptureCallback() method in Node.js:
Example 1:
Output:
false true
Example 2:
Output:
no callback has been set using process.setUncaughtExceptionCaptureCallback() method a callback has been set using process.setUncaughtExceptionCaptureCallback() method no callback has been set using process.setUncaughtExceptionCaptureCallback() method
Note: The above program will compile and run by using the node filename.js command, only in POSIX platforms.
Reference: https://nodejs.org/api/process.html#process_process_setuncaughtexceptioncapturecallback_fn