From 7bfcb4dd10d31f5f9566c90a28449c0951f3a48e Mon Sep 17 00:00:00 2001 From: Luca Casonato Date: Tue, 10 Sep 2024 20:12:24 +0200 Subject: feat(cli): use NotCapable error for permission errors (#25431) Closes #7394 --------- Co-authored-by: snek --- runtime/js/01_errors.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'runtime/js/01_errors.js') diff --git a/runtime/js/01_errors.js b/runtime/js/01_errors.js index bfcb540e2..ea567a5d0 100644 --- a/runtime/js/01_errors.js +++ b/runtime/js/01_errors.js @@ -1,7 +1,7 @@ // Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. import { core, primordials } from "ext:core/mod.js"; -const { BadResource, Interrupted, PermissionDenied } = core; +const { BadResource, Interrupted, NotCapable } = core; const { Error } = primordials; class NotFound extends Error { @@ -116,6 +116,13 @@ class Busy extends Error { } } +class PermissionDenied extends Error { + constructor(msg) { + super(msg); + this.name = "PermissionDenied"; + } +} + class NotSupported extends Error { constructor(msg) { super(msg); @@ -176,6 +183,7 @@ const errors = { IsADirectory, NetworkUnreachable, NotADirectory, + NotCapable, }; export { errors }; -- cgit v1.2.3