nodejs/test/parallel/test-exception-handler2.js

23 lines
463 B
JavaScript
Raw Normal View History

'use strict';
require('../common');
2010-12-04 15:20:34 -08:00
var assert = require('assert');
process.on('uncaughtException', function(err) {
console.log('Caught exception: ' + err);
});
var timeoutFired = false;
setTimeout(function() {
console.log('This will still run.');
timeoutFired = true;
}, 500);
process.on('exit', function() {
assert.ok(timeoutFired);
});
// Intentionally cause an exception, but don't catch it.
nonexistentFunc();
console.log('This will not run.');