summaryrefslogtreecommitdiff
path: root/src/errors.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/errors.rs')
-rw-r--r--src/errors.rs21
1 files changed, 20 insertions, 1 deletions
diff --git a/src/errors.rs b/src/errors.rs
index f16ba6299..55185df8e 100644
--- a/src/errors.rs
+++ b/src/errors.rs
@@ -1,6 +1,9 @@
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
-use hyper;
+
pub use msg::ErrorKind;
+use resolve_addr::ResolveAddrError;
+
+use hyper;
use std;
use std::fmt;
use std::io;
@@ -149,6 +152,22 @@ impl From<hyper::Error> for DenoError {
}
}
+impl From<ResolveAddrError> for DenoError {
+ fn from(e: ResolveAddrError) -> Self {
+ match e {
+ ResolveAddrError::Syntax => Self {
+ repr: Repr::Simple(
+ ErrorKind::InvalidInput,
+ "invalid address syntax".to_string(),
+ ),
+ },
+ ResolveAddrError::Resolution(io_err) => Self {
+ repr: Repr::IoErr(io_err),
+ },
+ }
+ }
+}
+
pub fn bad_resource() -> DenoError {
new(ErrorKind::BadResource, String::from("bad resource id"))
}