|
|
@ -43,10 +43,19 @@ Example of listening for `uncaughtException`: |
|
|
|
console.log('This will not run.'); |
|
|
|
|
|
|
|
Note that `uncaughtException` is a very crude mechanism for exception |
|
|
|
handling. Using try / catch in your program will give you more control over |
|
|
|
your program's flow. Especially for server programs that are designed to |
|
|
|
stay running forever, `uncaughtException` can be a useful safety mechanism. |
|
|
|
handling and may be removed in the future. |
|
|
|
|
|
|
|
Don't use it, use [domains](domain.html) instead. If you do use it, restart |
|
|
|
your application after every unhandled exception! |
|
|
|
|
|
|
|
Do *not* use it as the node.js equivalent of `On Error Resume Next`. An |
|
|
|
unhandled exception means your application - and by extension node.js itself - |
|
|
|
is in an undefined state. Blindly resuming means *anything* could happen. |
|
|
|
|
|
|
|
Think of resuming as pulling the power cord when you are upgrading your system. |
|
|
|
Nine out of ten times nothing happens - but the 10th time, your system is bust. |
|
|
|
|
|
|
|
You have been warned. |
|
|
|
|
|
|
|
## Signal Events |
|
|
|
|
|
|
|