summaryrefslogtreecommitdiff
path: root/test/parallel/test-exception-handler.js
blob: 506fbaed0ebf63b6931c84d5e23eaf26f2bbb01a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
'use strict';
const common = require('../common');
const assert = require('assert');

const MESSAGE = 'catch me if you can';

process.on('uncaughtException', common.mustCall(function(e) {
  console.log('uncaught exception! 1');
  assert.strictEqual(MESSAGE, e.message);
}));

process.on('uncaughtException', common.mustCall(function(e) {
  console.log('uncaught exception! 2');
  assert.strictEqual(MESSAGE, e.message);
}));

setTimeout(function() {
  throw new Error(MESSAGE);
}, 10);