diff options
author | Ryan Dahl <ry@tinyclouds.org> | 2019-01-13 22:14:59 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-01-13 22:14:59 -0500 |
commit | 3c1a0ad19e7b044bb40f979ec4c5f81bf39dec4b (patch) | |
tree | b19ed1c0c1a15e084a8fd479b32fd0567aee19d3 /src/errors.rs | |
parent | 9e9550ceeaa4d0751e8d1cb79acb962f1b8682d5 (diff) |
Properly parse network addresses. (#1515)
Diffstat (limited to 'src/errors.rs')
-rw-r--r-- | src/errors.rs | 21 |
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")) } |