summaryrefslogtreecommitdiffstats
path: root/src/error.rs
diff options
context:
space:
mode:
authorup9cloud <8325632+up9cloud@users.noreply.github.com>2020-07-06 13:07:05 -0700
committerMatthias Beyer <mail@beyermatthias.de>2021-05-15 14:35:58 +0200
commit70c503af8b3cb3d73bbbea673bb49460df318e5e (patch)
tree3550f1015af6186e5f6c1cade83345ee48609e22 /src/error.rs
parent266f504d9f23e192c03ef486f58a678847249b60 (diff)
Support format json5
Diffstat (limited to 'src/error.rs')
-rw-r--r--src/error.rs12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/error.rs b/src/error.rs
index 28142b5..9778649 100644
--- a/src/error.rs
+++ b/src/error.rs
@@ -94,6 +94,18 @@ impl ConfigError {
}
}
+ // Have a proper error fire if the root of a file is ever not a Table
+ // TODO: for now only json5 checked, need to finish others
+ #[doc(hidden)]
+ pub fn invalid_root(origin: Option<&String>, unexpected: Unexpected) -> Box<Self> {
+ Box::new(ConfigError::Type {
+ origin: origin.map(|s| s.to_owned()),
+ unexpected,
+ expected: "a map",
+ key: None,
+ })
+ }
+
// FIXME: pub(crate)
#[doc(hidden)]
pub fn extend_with_key(self, key: &str) -> Self {