diff options
author | Bartek IwaĆczuk <biwanczuk@gmail.com> | 2019-06-09 15:08:20 +0200 |
---|---|---|
committer | Ryan Dahl <ry@tinyclouds.org> | 2019-06-09 09:08:20 -0400 |
commit | a115340288d974f141cceb16faac71914402c445 (patch) | |
tree | 80353d2579e6d6dc9febd449f1f779ffa62c8397 /cli/errors.rs | |
parent | 8ec5276d30dac59ced0ca7e35e07e20644ee2188 (diff) |
feat: Import maps (#2360)
Diffstat (limited to 'cli/errors.rs')
-rw-r--r-- | cli/errors.rs | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/cli/errors.rs b/cli/errors.rs index 8e57fe5f4..eb0fc7d27 100644 --- a/cli/errors.rs +++ b/cli/errors.rs @@ -1,4 +1,5 @@ // Copyright 2018-2019 the Deno authors. All rights reserved. MIT license. +use crate::import_map::ImportMapError; use crate::js_errors::JSErrorColor; pub use crate::msg::ErrorKind; use crate::resolve_addr::ResolveAddrError; @@ -24,6 +25,7 @@ enum Repr { IoErr(io::Error), UrlErr(url::ParseError), HyperErr(hyper::Error), + ImportMapErr(ImportMapError), } pub fn new(kind: ErrorKind, msg: String) -> DenoError { @@ -92,6 +94,7 @@ impl DenoError { ErrorKind::HttpOther } } + Repr::ImportMapErr(ref _err) => ErrorKind::ImportMapError, } } } @@ -103,6 +106,7 @@ impl fmt::Display for DenoError { Repr::IoErr(ref err) => err.fmt(f), Repr::UrlErr(ref err) => err.fmt(f), Repr::HyperErr(ref err) => err.fmt(f), + Repr::ImportMapErr(ref err) => f.pad(&err.msg), } } } @@ -114,6 +118,7 @@ impl std::error::Error for DenoError { Repr::IoErr(ref err) => err.description(), Repr::UrlErr(ref err) => err.description(), Repr::HyperErr(ref err) => err.description(), + Repr::ImportMapErr(ref err) => &err.msg, } } @@ -123,6 +128,7 @@ impl std::error::Error for DenoError { Repr::IoErr(ref err) => Some(err), Repr::UrlErr(ref err) => Some(err), Repr::HyperErr(ref err) => Some(err), + Repr::ImportMapErr(ref _err) => None, } } } @@ -202,6 +208,14 @@ impl From<UnixError> for DenoError { } } +impl From<ImportMapError> for DenoError { + fn from(err: ImportMapError) -> Self { + Self { + repr: Repr::ImportMapErr(err), + } + } +} + pub fn bad_resource() -> DenoError { new(ErrorKind::BadResource, String::from("bad resource id")) } |