mirror of
https://github.com/nodejs/node.git
synced 2024-11-25 08:19:38 +01:00
3e1b1dd4a9
The copyright and license notice is already in the LICENSE file. There is no justifiable reason to also require that it be included in every file, since the individual files are not individually distributed except as part of the entire package.
37 lines
904 B
JavaScript
37 lines
904 B
JavaScript
var common = require('../common');
|
|
var assert = require('assert');
|
|
|
|
var order = [],
|
|
exceptionHandled = false;
|
|
|
|
// This nextTick function will throw an error. It should only be called once.
|
|
// When it throws an error, it should still get removed from the queue.
|
|
process.nextTick(function() {
|
|
order.push('A');
|
|
// cause an error
|
|
what();
|
|
});
|
|
|
|
// This nextTick function should remain in the queue when the first one
|
|
// is removed. It should be called if the error in the first one is
|
|
// caught (which we do in this test).
|
|
process.nextTick(function() {
|
|
order.push('C');
|
|
});
|
|
|
|
process.on('uncaughtException', function() {
|
|
if (!exceptionHandled) {
|
|
exceptionHandled = true;
|
|
order.push('B');
|
|
}
|
|
else {
|
|
// If we get here then the first process.nextTick got called twice
|
|
order.push('OOPS!');
|
|
}
|
|
});
|
|
|
|
process.on('exit', function() {
|
|
assert.deepEqual(['A', 'B', 'C'], order);
|
|
});
|
|
|