diff options
author | Bert Belder <bertbelder@gmail.com> | 2019-07-11 00:53:48 +0200 |
---|---|---|
committer | Ryan Dahl <ry@tinyclouds.org> | 2019-07-11 14:37:00 -0400 |
commit | abe8a113ad8004f160eac5f3f115cb28c5072ba7 (patch) | |
tree | 099b2b019bd7b5d1689cfa5b4bef3ceded10c59d /cli/import_map.rs | |
parent | db5c66a638d399d5ebb2832bb7b52e8f76ced49d (diff) |
Refactor error to use dynamic dispatch and traits
This is in preperation for dynamic import (#1789), which is more easily
implemented when errors are dynamic.
Diffstat (limited to 'cli/import_map.rs')
-rw-r--r-- | cli/import_map.rs | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/cli/import_map.rs b/cli/import_map.rs index 1f136a3e9..abe9835f8 100644 --- a/cli/import_map.rs +++ b/cli/import_map.rs @@ -3,6 +3,8 @@ use indexmap::IndexMap; use serde_json::Map; use serde_json::Value; use std::cmp::Ordering; +use std::error::Error; +use std::fmt; use std::fs; use url::Url; @@ -19,6 +21,14 @@ impl ImportMapError { } } +impl fmt::Display for ImportMapError { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + f.pad(&self.msg) + } +} + +impl Error for ImportMapError {} + // NOTE: here is difference between deno and reference implementation - deno currently // can't resolve URL with other schemes (eg. data:, about:, blob:) const SUPPORTED_FETCH_SCHEMES: [&str; 3] = ["http", "https", "file"]; |