mirror of
https://github.com/nodejs/node.git
synced 2025-05-11 12:55:53 +00:00

Accessing JS objects can be trapped with proxy handlers. These handlers can throw when no node-api errors occur. In such cases, `napi_pending_exception` should be returned. PR-URL: https://github.com/nodejs/node/pull/48607 Reviewed-By: Gabriel Schulhof <gabrielschulhof@gmail.com> Reviewed-By: Michael Dawson <midawson@redhat.com>
19 lines
575 B
JavaScript
19 lines
575 B
JavaScript
'use strict';
|
|
const common = require('../../common');
|
|
|
|
// Test
|
|
const { testExceptions } = require(`./build/${common.buildType}/test_exceptions`);
|
|
|
|
function throws() {
|
|
throw new Error('foobar');
|
|
}
|
|
testExceptions(new Proxy({}, {
|
|
get: common.mustCallAtLeast(throws, 1),
|
|
getOwnPropertyDescriptor: common.mustCallAtLeast(throws, 1),
|
|
defineProperty: common.mustCallAtLeast(throws, 1),
|
|
deleteProperty: common.mustCallAtLeast(throws, 1),
|
|
has: common.mustCallAtLeast(throws, 1),
|
|
set: common.mustCallAtLeast(throws, 1),
|
|
ownKeys: common.mustCallAtLeast(throws, 1),
|
|
}));
|