From 33d2e3d53601c4e56e4ac56b75e336cf1152ad08 Mon Sep 17 00:00:00 2001 From: "Kevin (Kun) \"Kassimo\" Qian" Date: Sun, 15 Dec 2019 01:23:12 -0800 Subject: std/node: better error message for read perm in require() (#3502) --- std/node/module.ts | 3 +++ 1 file changed, 3 insertions(+) (limited to 'std/node/module.ts') 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; } } -- cgit v1.2.3