7019: Try serde_path_to_error for LSP InitializeParams r=matklad a=lnicola



Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
This commit is contained in:
bors[bot]
2020-12-23 12:04:32 +00:00
committed by GitHub
3 changed files with 12 additions and 1 deletions

View File

@@ -46,7 +46,7 @@ pub type Error = Box<dyn std::error::Error + Send + Sync>;
pub type Result<T, E = Error> = std::result::Result<T, E>;
pub fn from_json<T: DeserializeOwned>(what: &'static str, json: serde_json::Value) -> Result<T> {
let res = T::deserialize(&json)
let res = serde_path_to_error::deserialize(&json)
.map_err(|e| format!("Failed to deserialize {}: {}; {}", what, e, json))?;
Ok(res)
}