Skip to content

Commit

Permalink
Check for permissions in the render function
Browse files Browse the repository at this point in the history
  • Loading branch information
predetermined committed Dec 13, 2020
1 parent 2e98c6f commit c436d27
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion aqua.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,11 @@ export default class Aqua {
public async render(filePath: string): Promise<string> {
try {
return this.textDecoder.decode(await Deno.readFile(filePath));
}catch {
}catch(error) {
if (error instanceof Deno.errors.PermissionDenied) {
return "Please run your application with the '--allow-read' flag.";
}

return "Could not render file.";
}
}
Expand Down

0 comments on commit c436d27

Please sign in to comment.