From 2e209c0ff62b0363ca2b0533fafb4406a9b63cb2 Mon Sep 17 00:00:00 2001 From: lionel-rowe Date: Wed, 28 Aug 2024 13:46:19 +0800 Subject: [PATCH] docs(async): add note about `deadline()` `DOMException` name of `TimeoutError` (#5833) * docs(async): add note about deadline DOMException name of TimeoutError * Document all cases for thrown error --- async/deadline.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/async/deadline.ts b/async/deadline.ts index add5a6f48..1c5bb3d5b 100644 --- a/async/deadline.ts +++ b/async/deadline.ts @@ -16,8 +16,12 @@ export interface DeadlineOptions { * Note: Prefer to use {@linkcode AbortSignal.timeout} instead for the APIs * that accept {@linkcode AbortSignal}. * - * @throws {DOMException} When the provided duration runs out before resolving - * or if the optional signal is aborted, and `signal.reason` is undefined. + * @throws {DOMException & { name: "TimeoutError" }} If the provided duration + * runs out before resolving. + * @throws {DOMException & { name: "AbortError" }} If the optional signal is + * aborted with the default `reason` before resolving or timing out. + * @throws {AbortSignal["reason"]} If the optional signal is aborted with a + * custom `reason` before resolving or timing out. * @typeParam T The type of the provided and returned promise. * @param p The promise to make rejectable. * @param ms Duration in milliseconds for when the promise should time out.