summaryrefslogtreecommitdiff
path: root/test/simple/test-exception-handler2.js
blob: 77f3eb1d5cfd7715fec8cde2d8f306e938a1d209 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
var common = require('../common');
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.');