diff options
Diffstat (limited to 'cli/deno_error.rs')
-rw-r--r-- | cli/deno_error.rs | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/cli/deno_error.rs b/cli/deno_error.rs index eb885adb8..551547e26 100644 --- a/cli/deno_error.rs +++ b/cli/deno_error.rs @@ -11,6 +11,7 @@ use hyper; use reqwest; use rustyline::error::ReadlineError; use std; +use std::env::VarError; use std::error::Error; use std::fmt; use std::io; @@ -136,6 +137,16 @@ impl GetErrorKind for ModuleResolutionError { } } +impl GetErrorKind for VarError { + fn kind(&self) -> ErrorKind { + use VarError::*; + match self { + NotPresent => ErrorKind::NotFound, + NotUnicode(..) => ErrorKind::InvalidData, + } + } +} + impl GetErrorKind for io::Error { fn kind(&self) -> ErrorKind { use io::ErrorKind::*; @@ -294,6 +305,7 @@ impl GetErrorKind for dyn AnyError { .or_else(|| self.downcast_ref::<StaticError>().map(Get::kind)) .or_else(|| self.downcast_ref::<uri::InvalidUri>().map(Get::kind)) .or_else(|| self.downcast_ref::<url::ParseError>().map(Get::kind)) + .or_else(|| self.downcast_ref::<VarError>().map(Get::kind)) .or_else(|| self.downcast_ref::<ReadlineError>().map(Get::kind)) .or_else(|| { self |