std/node: better error message for read perm in require() (#3502)

This commit is contained in:
Kevin (Kun) "Kassimo" Qian 2019-12-15 01:23:12 -08:00 committed by Ry Dahl
parent de94698915
commit 33d2e3d536

View file

@ -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;
}
}