summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKevin (Kun) "Kassimo" Qian <kevinkassimo@gmail.com>2019-12-15 01:23:12 -0800
committerRy Dahl <ry@tinyclouds.org>2019-12-15 17:23:12 +0800
commit33d2e3d53601c4e56e4ac56b75e336cf1152ad08 (patch)
treed6f1535a35b033e6becf936a30befcef9510c915
parentde946989150d74204678da7f613a4e039d033e46 (diff)
std/node: better error message for read perm in require() (#3502)
-rw-r--r--std/node/module.ts3
1 files changed, 3 insertions, 0 deletions
diff --git a/std/node/module.ts b/std/node/module.ts
index 3d51bf641..7ed43349f 100644
--- a/std/node/module.ts
+++ b/std/node/module.ts
@@ -54,6 +54,9 @@ function stat(filename: string): StatResult {
if (statCache !== null) statCache.set(filename, result);
return result;
} catch (e) {
+ if (e.kind === Deno.ErrorKind.PermissionDenied) {
+ throw new Error("CJS loader requires --allow-read.");
+ }
return -1;
}
}