summaryrefslogtreecommitdiff
path: root/runtime/rt/01_errors.js
diff options
context:
space:
mode:
authorBartek IwaƄczuk <biwanczuk@gmail.com>2020-12-13 19:45:53 +0100
committerGitHub <noreply@github.com>2020-12-13 19:45:53 +0100
commit2e74f164b6dcf0ecbf8dd38fba9fae550d784bd0 (patch)
tree61abe8e09d5331ace5d9de529f0e2737a8e05dbb /runtime/rt/01_errors.js
parent84ef9bd21fb48fb6b5fbc8dafc3de9f361bade3b (diff)
refactor: deno_runtime crate (#8640)
This commit moves Deno JS runtime, ops, permissions and inspector implementation to new "deno_runtime" crate located in "runtime/" directory. Details in "runtime/README.md". Co-authored-by: Ryan Dahl <ry@tinyclouds.org>
Diffstat (limited to 'runtime/rt/01_errors.js')
-rw-r--r--runtime/rt/01_errors.js162
1 files changed, 162 insertions, 0 deletions
diff --git a/runtime/rt/01_errors.js b/runtime/rt/01_errors.js
new file mode 100644
index 000000000..d5933069b
--- /dev/null
+++ b/runtime/rt/01_errors.js
@@ -0,0 +1,162 @@
+// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license.
+
+((window) => {
+ class NotFound extends Error {
+ constructor(msg) {
+ super(msg);
+ this.name = "NotFound";
+ }
+ }
+
+ class PermissionDenied extends Error {
+ constructor(msg) {
+ super(msg);
+ this.name = "PermissionDenied";
+ }
+ }
+
+ class ConnectionRefused extends Error {
+ constructor(msg) {
+ super(msg);
+ this.name = "ConnectionRefused";
+ }
+ }
+
+ class ConnectionReset extends Error {
+ constructor(msg) {
+ super(msg);
+ this.name = "ConnectionReset";
+ }
+ }
+
+ class ConnectionAborted extends Error {
+ constructor(msg) {
+ super(msg);
+ this.name = "ConnectionAborted";
+ }
+ }
+
+ class NotConnected extends Error {
+ constructor(msg) {
+ super(msg);
+ this.name = "NotConnected";
+ }
+ }
+
+ class AddrInUse extends Error {
+ constructor(msg) {
+ super(msg);
+ this.name = "AddrInUse";
+ }
+ }
+
+ class AddrNotAvailable extends Error {
+ constructor(msg) {
+ super(msg);
+ this.name = "AddrNotAvailable";
+ }
+ }
+
+ class BrokenPipe extends Error {
+ constructor(msg) {
+ super(msg);
+ this.name = "BrokenPipe";
+ }
+ }
+
+ class AlreadyExists extends Error {
+ constructor(msg) {
+ super(msg);
+ this.name = "AlreadyExists";
+ }
+ }
+
+ class InvalidData extends Error {
+ constructor(msg) {
+ super(msg);
+ this.name = "InvalidData";
+ }
+ }
+
+ class TimedOut extends Error {
+ constructor(msg) {
+ super(msg);
+ this.name = "TimedOut";
+ }
+ }
+
+ class Interrupted extends Error {
+ constructor(msg) {
+ super(msg);
+ this.name = "Interrupted";
+ }
+ }
+
+ class WriteZero extends Error {
+ constructor(msg) {
+ super(msg);
+ this.name = "WriteZero";
+ }
+ }
+
+ class UnexpectedEof extends Error {
+ constructor(msg) {
+ super(msg);
+ this.name = "UnexpectedEof";
+ }
+ }
+
+ class BadResource extends Error {
+ constructor(msg) {
+ super(msg);
+ this.name = "BadResource";
+ }
+ }
+
+ class Http extends Error {
+ constructor(msg) {
+ super(msg);
+ this.name = "Http";
+ }
+ }
+
+ class Busy extends Error {
+ constructor(msg) {
+ super(msg);
+ this.name = "Busy";
+ }
+ }
+
+ class NotSupported extends Error {
+ constructor(msg) {
+ super(msg);
+ this.name = "NotSupported";
+ }
+ }
+
+ const errors = {
+ NotFound,
+ PermissionDenied,
+ ConnectionRefused,
+ ConnectionReset,
+ ConnectionAborted,
+ NotConnected,
+ AddrInUse,
+ AddrNotAvailable,
+ BrokenPipe,
+ AlreadyExists,
+ InvalidData,
+ TimedOut,
+ Interrupted,
+ WriteZero,
+ UnexpectedEof,
+ BadResource,
+ Http,
+ Busy,
+ NotSupported,
+ };
+
+ window.__bootstrap.errors = {
+ errors,
+ };
+})(this);