From 8b5be962f5dad64da1363052a3fcd4432cc08a71 Mon Sep 17 00:00:00 2001 From: Leo Kettmeir Date: Sun, 12 Feb 2023 23:14:33 +0100 Subject: fix: add WouldBlock error (#17339) --- cli/tests/unit/error_test.ts | 1 + cli/tsc/dts/lib.deno.ns.d.ts | 12 +++++++++--- 2 files changed, 10 insertions(+), 3 deletions(-) (limited to 'cli') diff --git a/cli/tests/unit/error_test.ts b/cli/tests/unit/error_test.ts index bb7a9baf8..6fdf4f762 100644 --- a/cli/tests/unit/error_test.ts +++ b/cli/tests/unit/error_test.ts @@ -15,6 +15,7 @@ Deno.test("Errors work", () => { assert(new Deno.errors.InvalidData("msg") instanceof Error); assert(new Deno.errors.TimedOut("msg") instanceof Error); assert(new Deno.errors.Interrupted("msg") instanceof Error); + assert(new Deno.errors.WouldBlock("msg") instanceof Error); assert(new Deno.errors.WriteZero("msg") instanceof Error); assert(new Deno.errors.UnexpectedEof("msg") instanceof Error); assert(new Deno.errors.BadResource("msg") instanceof Error); diff --git a/cli/tsc/dts/lib.deno.ns.d.ts b/cli/tsc/dts/lib.deno.ns.d.ts index 33a568b65..d81e4afcd 100644 --- a/cli/tsc/dts/lib.deno.ns.d.ts +++ b/cli/tsc/dts/lib.deno.ns.d.ts @@ -219,6 +219,12 @@ declare namespace Deno { * * @category Errors */ export class Interrupted extends Error {} + /** + * Raised when the underlying operating system would need to block to + * complete but an asynchronous (non-blocking) API is used. + * + * @category Errors */ + export class WouldBlock extends Error {} /** * Raised when expecting to write to a IO buffer resulted in zero bytes * being written. @@ -4377,7 +4383,7 @@ declare namespace Deno { * const status = await Deno.permissions.query({ name: "read", path: "/etc" }); * console.log(status.state); * ``` - * + * * ```ts * const status = Deno.permissions.querySync({ name: "read", path: "/etc" }); * console.log(status.state); @@ -4391,7 +4397,7 @@ declare namespace Deno { * const status = await Deno.permissions.revoke({ name: "run" }); * assert(status.state !== "granted") * ``` - * + * * ```ts * import { assert } from "https://deno.land/std/testing/asserts.ts"; * @@ -4409,7 +4415,7 @@ declare namespace Deno { * console.log("'env' permission is denied."); * } * ``` - * + * * ```ts * const status = Deno.permissions.requestSync({ name: "env" }); * if (status.state === "granted") { -- cgit v1.2.3