Try serde_path_to_error for LSP InitializeParams

This commit is contained in:
Laurențiu Nicola
2020-12-23 13:21:58 +02:00
parent 85a2875161
commit 4e89c2a664
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)
}