diff options
author | Andy Finch <andyfinch7@gmail.com> | 2019-12-05 15:30:20 -0500 |
---|---|---|
committer | Ry Dahl <ry@tinyclouds.org> | 2019-12-05 15:30:20 -0500 |
commit | 7c3b9b4f4f2f4ec8fdeb0e77bb853fd22ffaa476 (patch) | |
tree | aeafe5cc2560c5366704d7a580a5b0e0dced504d /cli/deno_error.rs | |
parent | 214b3eb29aa9cce8a55a247b4bd816cbd19bfe6b (diff) |
feat: first pass at native plugins (#3372)
Diffstat (limited to 'cli/deno_error.rs')
-rw-r--r-- | cli/deno_error.rs | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/cli/deno_error.rs b/cli/deno_error.rs index 8cff29d30..8d0eea201 100644 --- a/cli/deno_error.rs +++ b/cli/deno_error.rs @@ -6,6 +6,7 @@ pub use crate::msg::ErrorKind; use deno::AnyError; use deno::ErrBox; use deno::ModuleResolutionError; +use dlopen::Error as DlopenError; use http::uri; use hyper; use reqwest; @@ -292,6 +293,19 @@ mod unix { } } +impl GetErrorKind for DlopenError { + fn kind(&self) -> ErrorKind { + use dlopen::Error::*; + match self { + NullCharacter(_) => ErrorKind::Other, + OpeningLibraryError(e) => GetErrorKind::kind(e), + SymbolGettingError(e) => GetErrorKind::kind(e), + NullSymbol => ErrorKind::Other, + AddrNotMatchingDll(e) => GetErrorKind::kind(e), + } + } +} + impl GetErrorKind for dyn AnyError { fn kind(&self) -> ErrorKind { use self::GetErrorKind as Get; @@ -325,6 +339,7 @@ impl GetErrorKind for dyn AnyError { .downcast_ref::<serde_json::error::Error>() .map(Get::kind) }) + .or_else(|| self.downcast_ref::<DlopenError>().map(Get::kind)) .or_else(|| unix_error_kind(self)) .unwrap_or_else(|| { panic!("Can't get ErrorKind for {:?}", self); |