xref: /third_party/node/test/parallel/test-promises-unhandled-proxy-rejections.js
  • Home
  • History
  • Annotate Annotate
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
  • only in /third_party/node/test/parallel/
11cb0ef41Sopenharmony_ci// Flags: --unhandled-rejections=none
21cb0ef41Sopenharmony_ci'use strict';
31cb0ef41Sopenharmony_ciconst common = require('../common');
41cb0ef41Sopenharmony_ci
51cb0ef41Sopenharmony_cifunction throwErr() {
61cb0ef41Sopenharmony_ci  throw new Error('Error from proxy');
71cb0ef41Sopenharmony_ci}
81cb0ef41Sopenharmony_ci
91cb0ef41Sopenharmony_ciconst thorny = new Proxy({}, {
101cb0ef41Sopenharmony_ci  getPrototypeOf: throwErr,
111cb0ef41Sopenharmony_ci  setPrototypeOf: throwErr,
121cb0ef41Sopenharmony_ci  isExtensible: throwErr,
131cb0ef41Sopenharmony_ci  preventExtensions: throwErr,
141cb0ef41Sopenharmony_ci  getOwnPropertyDescriptor: throwErr,
151cb0ef41Sopenharmony_ci  defineProperty: throwErr,
161cb0ef41Sopenharmony_ci  has: throwErr,
171cb0ef41Sopenharmony_ci  get: throwErr,
181cb0ef41Sopenharmony_ci  set: throwErr,
191cb0ef41Sopenharmony_ci  deleteProperty: throwErr,
201cb0ef41Sopenharmony_ci  ownKeys: throwErr,
211cb0ef41Sopenharmony_ci  apply: throwErr,
221cb0ef41Sopenharmony_ci  construct: throwErr
231cb0ef41Sopenharmony_ci});
241cb0ef41Sopenharmony_ci
251cb0ef41Sopenharmony_ciprocess.on('warning', common.mustNotCall());
261cb0ef41Sopenharmony_ci
271cb0ef41Sopenharmony_ci// Ensure this doesn't crash
281cb0ef41Sopenharmony_ciPromise.reject(thorny);
29

Indexes created Thu Nov 07 10:32:03 CST 2024