mirror of
https://github.com/nodejs/node.git
synced 2026-10-28 10:15:07 +08:00
Signed-off-by: James M Snell <jasnell@gmail.com> PR-URL: https://github.com/nodejs/node/pull/65805 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Moshe Atlow <moshe@atlow.co.il> Reviewed-By: LiviaMedeiros <livia@cirno.name>
26 lines
549 B
JavaScript
26 lines
549 B
JavaScript
'use strict';
|
|
|
|
const common = require('../common');
|
|
const assert = require('node:assert');
|
|
const { markPromiseAsHandled } = require('node:util');
|
|
|
|
process.on('unhandledRejection', common.mustNotCall());
|
|
|
|
markPromiseAsHandled(Promise.reject(123));
|
|
|
|
{
|
|
const { promise, reject } = Promise.withResolvers();
|
|
markPromiseAsHandled(promise);
|
|
reject(123);
|
|
}
|
|
|
|
{
|
|
const { promise, reject } = Promise.withResolvers();
|
|
reject(123);
|
|
markPromiseAsHandled(promise);
|
|
}
|
|
|
|
assert.throws(() => markPromiseAsHandled(123), {
|
|
code: 'ERR_INVALID_ARG_TYPE',
|
|
});
|