summaryrefslogtreecommitdiff
path: root/runtime/js
diff options
context:
space:
mode:
authorBartek IwaƄczuk <biwanczuk@gmail.com>2023-06-29 01:46:16 +0200
committerGitHub <noreply@github.com>2023-06-29 01:46:16 +0200
commit0434e041778cb3803de901b841f18b8fd8cc2a67 (patch)
tree0c89ce9c09e8a53c20fef5a5053ffdd4af382400 /runtime/js
parent673cdd714921124fae8ecd3c3a405e37a8ece404 (diff)
feat: add more Deno.errors classes (#19514)
This commit adds following new error classes: - `Deno.errors.NotADirectory` - `Deno.errors.FilesystemLoop` - `Deno.errors.IsADirectory` - `Deno.errors.NetworkUnreachable` Closes https://github.com/denoland/deno/issues/19408
Diffstat (limited to 'runtime/js')
-rw-r--r--runtime/js/01_errors.js32
-rw-r--r--runtime/js/99_main.js4
2 files changed, 36 insertions, 0 deletions
diff --git a/runtime/js/01_errors.js b/runtime/js/01_errors.js
index 8288e3ce9..0c54f6581 100644
--- a/runtime/js/01_errors.js
+++ b/runtime/js/01_errors.js
@@ -131,6 +131,34 @@ class NotSupported extends Error {
}
}
+class FilesystemLoop extends Error {
+ constructor(msg) {
+ super(msg);
+ this.name = "FilesystemLoop";
+ }
+}
+
+class IsADirectory extends Error {
+ constructor(msg) {
+ super(msg);
+ this.name = "IsADirectory";
+ }
+}
+
+class NetworkUnreachable extends Error {
+ constructor(msg) {
+ super(msg);
+ this.name = "NetworkUnreachable";
+ }
+}
+
+class NotADirectory extends Error {
+ constructor(msg) {
+ super(msg);
+ this.name = "NotADirectory";
+ }
+}
+
const errors = {
NotFound,
PermissionDenied,
@@ -152,6 +180,10 @@ const errors = {
Http,
Busy,
NotSupported,
+ FilesystemLoop,
+ IsADirectory,
+ NetworkUnreachable,
+ NotADirectory,
};
export { errors };
diff --git a/runtime/js/99_main.js b/runtime/js/99_main.js
index 511368141..0c8989701 100644
--- a/runtime/js/99_main.js
+++ b/runtime/js/99_main.js
@@ -251,6 +251,10 @@ core.registerErrorClass("BadResource", errors.BadResource);
core.registerErrorClass("Http", errors.Http);
core.registerErrorClass("Busy", errors.Busy);
core.registerErrorClass("NotSupported", errors.NotSupported);
+core.registerErrorClass("FilesystemLoop", errors.FilesystemLoop);
+core.registerErrorClass("IsADirectory", errors.IsADirectory);
+core.registerErrorClass("NetworkUnreachable", errors.NetworkUnreachable);
+core.registerErrorClass("NotADirectory", errors.NotADirectory);
core.registerErrorBuilder(
"DOMExceptionOperationError",
function DOMExceptionOperationError(msg) {