Fix error message for config.get deserialization error
The error message for a deserialization failure was missing a call to `format!`.
This commit is contained in:
parent
08d9fddfc9
commit
adcbd117da
1 changed files with 5 additions and 2 deletions
|
|
@ -204,7 +204,7 @@ impl Config {
|
||||||
value
|
value
|
||||||
.clone()
|
.clone()
|
||||||
.try_into()
|
.try_into()
|
||||||
.with_context(|| "Failed to deserialize `{name}`")
|
.with_context(|| format!("Failed to deserialize `{name}`"))
|
||||||
})
|
})
|
||||||
.transpose()
|
.transpose()
|
||||||
}
|
}
|
||||||
|
|
@ -1156,6 +1156,9 @@ mod tests {
|
||||||
"#;
|
"#;
|
||||||
let cfg = Config::from_str(src).unwrap();
|
let cfg = Config::from_str(src).unwrap();
|
||||||
let err = cfg.get::<String>("preprocessor.foo.x").unwrap_err();
|
let err = cfg.get::<String>("preprocessor.foo.x").unwrap_err();
|
||||||
assert_eq!(err.to_string(), "Failed to deserialize `{name}`");
|
assert_eq!(
|
||||||
|
err.to_string(),
|
||||||
|
"Failed to deserialize `preprocessor.foo.x`"
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue