vm: behavior with --abort-on-uncaught-exception

  • Version: master
  • Platform: all
  • Subsystem: vm

In the following code, the vm.Script() constructor throws an exception. When node is run normally, the exception is caught and node exits cleanly. However, when run with --abort-on-uncaught-exception, the exception is treated as uncaught.

'use strict';
const vm = require('vm');

try {
  new vm.Script('[', {});
} catch (err) {}

Before attempting to fix this, I wanted to make sure there is agreement that this is a bug. This seems like something that could be handled in ShouldAbortOnUncaughtException().

Related: nodejs/node-report#60