Skip to content

Commit

Permalink
std/node: better error message for read perm in require() (denoland#3502
Browse files Browse the repository at this point in the history
)
  • Loading branch information
kevinkassimo authored and ry committed Dec 15, 2019
1 parent de94698 commit 33d2e3d
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions std/node/module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
Expand Down

0 comments on commit 33d2e3d

Please sign in to comment.