mirror of
https://github.com/nodejs/node.git
synced 2025-05-20 21:13:12 +00:00

This is a semver-major change that resolves DEP0018. All users that have set an unhandledRejection hook or set a non-default value for the --unhandled-rejections flag will see no change in behavior after this change. Refs: https://nodejs.org/dist/latest/docs/api/deprecations.html#deprecations_dep0018_unhandled_promise_rejections PR-URL: https://github.com/nodejs/node/pull/33021 Fixes: https://github.com/nodejs/node/issues/20392 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Mary Marchini <oss@mmarchini.me> Reviewed-By: Shelley Vohr <codebytere@gmail.com> Reviewed-By: Michael Dawson <midawson@redhat.com> Reviewed-By: Anatoli Papirovski <apapirovski@mac.com> Reviewed-By: Сковорода Никита Андреевич <chalkerx@gmail.com>
30 lines
615 B
JavaScript
30 lines
615 B
JavaScript
'use strict';
|
|
const common = require('../common');
|
|
|
|
common.disableCrashOnUnhandledRejection();
|
|
|
|
function throwErr() {
|
|
throw new Error('Error from proxy');
|
|
}
|
|
|
|
const thorny = new Proxy({}, {
|
|
getPrototypeOf: throwErr,
|
|
setPrototypeOf: throwErr,
|
|
isExtensible: throwErr,
|
|
preventExtensions: throwErr,
|
|
getOwnPropertyDescriptor: throwErr,
|
|
defineProperty: throwErr,
|
|
has: throwErr,
|
|
get: throwErr,
|
|
set: throwErr,
|
|
deleteProperty: throwErr,
|
|
ownKeys: throwErr,
|
|
apply: throwErr,
|
|
construct: throwErr
|
|
});
|
|
|
|
process.on('warning', common.mustNotCall());
|
|
|
|
// Ensure this doesn't crash
|
|
Promise.reject(thorny);
|