mirror of https://github.com/lukechilds/node.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
27 lines
600 B
27 lines
600 B
14 years ago
|
var common = require('../common');
|
||
|
var assert = require('assert');
|
||
15 years ago
|
|
||
|
var MESSAGE = 'catch me if you can';
|
||
|
var caughtException = false;
|
||
|
|
||
14 years ago
|
process.on('uncaughtException', function(e) {
|
||
14 years ago
|
console.log('uncaught exception! 1');
|
||
15 years ago
|
assert.equal(MESSAGE, e.message);
|
||
15 years ago
|
caughtException = true;
|
||
|
});
|
||
|
|
||
14 years ago
|
process.on('uncaughtException', function(e) {
|
||
14 years ago
|
console.log('uncaught exception! 2');
|
||
15 years ago
|
assert.equal(MESSAGE, e.message);
|
||
15 years ago
|
caughtException = true;
|
||
|
});
|
||
|
|
||
|
setTimeout(function() {
|
||
|
throw new Error(MESSAGE);
|
||
|
}, 10);
|
||
|
|
||
14 years ago
|
process.on('exit', function() {
|
||
14 years ago
|
console.log('exit');
|
||
15 years ago
|
assert.equal(true, caughtException);
|
||
15 years ago
|
});
|