From d8a9ada4523b5337b1f103fb02750d268a136635 Mon Sep 17 00:00:00 2001 From: James M Snell Date: Sat, 5 Sep 2026 01:38:28 +0000 Subject: [PATCH] src,lib: add util.markPromiseAsHandled Signed-off-by: James M Snell --- doc/api/util.md | 11 ++++++++++ lib/util.js | 8 +++++++ src/node_util.cc | 23 ++++++++++++++++++++ test/parallel/test-mark-promise-handled.js | 25 ++++++++++++++++++++++ 4 files changed, 67 insertions(+) create mode 100644 test/parallel/test-mark-promise-handled.js diff --git a/doc/api/util.md b/doc/api/util.md index f9bfed5b5998..52e2c06b09ff 100644 --- a/doc/api/util.md +++ b/doc/api/util.md @@ -1691,6 +1691,17 @@ console.log(util.isDeepStrictEqual(foo, bar, true)); See [`assert.deepStrictEqual()`][] for more information about deep strict equality. +## `util.markPromiseAsHandled(promise)` + + + +* `promise` {promise} The promise to mark as handled + +Marks a promise as handled so that unhandled rejections are ignored and are not +reported to the `'unhandledrejection'` event. + ## Class: `util.MIMEType`