mirror of https://github.com/lukechilds/node.git
Browse Source
This event can be used to overwrite the default exception mechanism which reports the exception and kills the node process. See google group post: http://groups.google.com/group/nodejs/browse_thread/thread/9721dc3a2638446fv0.7.4-release
Felix Geisendörfer
15 years ago
committed by
Ryan Dahl
3 changed files with 69 additions and 3 deletions
@ -0,0 +1,25 @@ |
|||
process.mixin(require("./common")); |
|||
|
|||
var MESSAGE = 'catch me if you can'; |
|||
var caughtException = false; |
|||
|
|||
process.addListener('uncaughtException', function (e) { |
|||
puts("uncaught exception! 1"); |
|||
assertEquals(MESSAGE, e.message); |
|||
caughtException = true; |
|||
}); |
|||
|
|||
process.addListener('uncaughtException', function (e) { |
|||
puts("uncaught exception! 2"); |
|||
assertEquals(MESSAGE, e.message); |
|||
caughtException = true; |
|||
}); |
|||
|
|||
setTimeout(function() { |
|||
throw new Error(MESSAGE); |
|||
}, 10); |
|||
|
|||
process.addListener("exit", function () { |
|||
puts("exit"); |
|||
assertTrue(caughtException); |
|||
}); |
Loading…
Reference in new issue