summaryrefslogtreecommitdiff
path: root/src/errors.rs
diff options
context:
space:
mode:
authorRyan Dahl <ry@tinyclouds.org>2019-01-30 17:21:31 -0500
committerGitHub <noreply@github.com>2019-01-30 17:21:31 -0500
commit00597ffde1ebb05a6c60ea7e09e6578c11f92820 (patch)
tree849b6b22c07ed38a4b424c363c06435ea2de4fa9 /src/errors.rs
parent7d278a0383ce634f4fa3dd792e9b202582a6fde1 (diff)
Refactor libdeno ES module interface. (#1624)
Allows for future asynchronous module loading. Add support for import.meta.url Fixes #1496
Diffstat (limited to 'src/errors.rs')
-rw-r--r--src/errors.rs18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/errors.rs b/src/errors.rs
index 0855e0079..74502acc5 100644
--- a/src/errors.rs
+++ b/src/errors.rs
@@ -1,5 +1,6 @@
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
+use crate::js_errors::JSError;
pub use crate::msg::ErrorKind;
use crate::resolve_addr::ResolveAddrError;
@@ -178,3 +179,20 @@ pub fn permission_denied() -> DenoError {
String::from("permission denied"),
)
}
+
+pub enum RustOrJsError {
+ Rust(DenoError),
+ Js(JSError),
+}
+
+impl From<DenoError> for RustOrJsError {
+ fn from(e: DenoError) -> Self {
+ RustOrJsError::Rust(e)
+ }
+}
+
+impl From<JSError> for RustOrJsError {
+ fn from(e: JSError) -> Self {
+ RustOrJsError::Js(e)
+ }
+}