1'use strict';
2
3const common = require('../common');
4const assert = require('assert');
5const domain = require('domain');
6
7// This test is similar to test-domain-error-types, but uses a single domain
8// to emit all errors.
9
10const d = new domain.Domain();
11
12const values = [
13  42, null, undefined, false, () => {}, 'string', Symbol('foo'),
14];
15
16d.on('error', common.mustCall((err) => {
17  assert(values.includes(err));
18}, values.length));
19
20for (const something of values) {
21  d.run(common.mustCall(() => {
22    process.nextTick(common.mustCall(() => {
23      throw something;
24    }));
25  }));
26}
27