We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 118c109 + adcbd11 commit 860e8d1Copy full SHA for 860e8d1
1 file changed
crates/mdbook-core/src/config.rs
@@ -204,7 +204,7 @@ impl Config {
204
value
205
.clone()
206
.try_into()
207
- .with_context(|| "Failed to deserialize `{name}`")
+ .with_context(|| format!("Failed to deserialize `{name}`"))
208
})
209
.transpose()
210
}
@@ -1147,4 +1147,18 @@ mod tests {
1147
assert_eq!(json!(TextDirection::RightToLeft), json!("rtl"));
1148
assert_eq!(json!(TextDirection::LeftToRight), json!("ltr"));
1149
1150
+
1151
+ #[test]
1152
+ fn get_deserialize_error() {
1153
+ let src = r#"
1154
+ [preprocessor.foo]
1155
+ x = 123
1156
+ "#;
1157
+ let cfg = Config::from_str(src).unwrap();
1158
+ let err = cfg.get::<String>("preprocessor.foo.x").unwrap_err();
1159
+ assert_eq!(
1160
+ err.to_string(),
1161
+ "Failed to deserialize `preprocessor.foo.x`"
1162
+ );
1163
+ }
1164
0 commit comments