summaryrefslogtreecommitdiff
path: root/cli/js
diff options
context:
space:
mode:
Diffstat (limited to 'cli/js')
-rw-r--r--cli/js/errors.ts10
-rw-r--r--cli/js/lib.deno.ns.d.ts1
-rw-r--r--cli/js/tests/read_file_test.ts6
3 files changed, 17 insertions, 0 deletions
diff --git a/cli/js/errors.ts b/cli/js/errors.ts
index fc4021321..69afcf148 100644
--- a/cli/js/errors.ts
+++ b/cli/js/errors.ts
@@ -23,6 +23,7 @@ export enum ErrorKind {
URIError = 20,
TypeError = 21,
Other = 22,
+ Busy = 23,
}
export function getErrorClass(kind: ErrorKind): { new (msg: string): Error } {
@@ -67,6 +68,8 @@ export function getErrorClass(kind: ErrorKind): { new (msg: string): Error } {
return BadResource;
case ErrorKind.Http:
return Http;
+ case ErrorKind.Busy:
+ return Busy;
}
}
@@ -172,6 +175,12 @@ class Http extends Error {
this.name = "Http";
}
}
+class Busy extends Error {
+ constructor(msg: string) {
+ super(msg);
+ this.name = "Busy";
+ }
+}
export const errors = {
NotFound: NotFound,
@@ -191,4 +200,5 @@ export const errors = {
UnexpectedEof: UnexpectedEof,
BadResource: BadResource,
Http: Http,
+ Busy: Busy,
};
diff --git a/cli/js/lib.deno.ns.d.ts b/cli/js/lib.deno.ns.d.ts
index 0ec27dbce..443952c96 100644
--- a/cli/js/lib.deno.ns.d.ts
+++ b/cli/js/lib.deno.ns.d.ts
@@ -1663,6 +1663,7 @@ declare namespace Deno {
UnexpectedEof: ErrorConstructor;
BadResource: ErrorConstructor;
Http: ErrorConstructor;
+ Busy: ErrorConstructor;
};
/** **UNSTABLE**: potentially want names to overlap more with browser.
diff --git a/cli/js/tests/read_file_test.ts b/cli/js/tests/read_file_test.ts
index 1b709b1f4..0d3cdf422 100644
--- a/cli/js/tests/read_file_test.ts
+++ b/cli/js/tests/read_file_test.ts
@@ -57,3 +57,9 @@ unitTest({ perms: { read: false } }, async function readFilePerm(): Promise<
}
assert(caughtError);
});
+
+unitTest({ perms: { read: true } }, function readFileSyncLoop(): void {
+ for (let i = 0; i < 256; i++) {
+ Deno.readFileSync("cli/tests/fixture.json");
+ }
+});