summaryrefslogtreecommitdiff
path: root/test/parallel/test-promises-unhandled-proxy-rejections.js
blob: 099df95691d4665654a3d5f51482e32f07076932 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
'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);