summaryrefslogtreecommitdiff
path: root/test/message/vm_caught_custom_runtime_error.js
blob: 237e8e3a105436e4f258d195aec2209b59dbbee7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
'use strict';
require('../common');
const vm = require('vm');

console.error('beginning');

// Regression test for https://github.com/nodejs/node/issues/7397:
// vm.runInThisContext() should not print out anything to stderr by itself.
try {
  vm.runInThisContext(`throw ({
    name: 'MyCustomError',
    message: 'This is a custom message'
  })`, { filename: 'test.vm' });
} catch (e) {
  console.error('received error', e.name);
}

console.error('end');