Log when failed to deserialize response from language server (#8046)

This should probably help us debug when language servers don't start up
properly.

Release Notes:

- N/A
This commit is contained in:
Thorsten Ball 2024-02-20 10:16:00 +01:00 committed by GitHub
parent 4616d66e1d
commit fc101c1fb3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -891,8 +891,13 @@ impl LanguageServer {
executor
.spawn(async move {
let response = match result {
Ok(response) => serde_json::from_str(&response)
.context("failed to deserialize response"),
Ok(response) => match serde_json::from_str(&response) {
Ok(deserialized) => Ok(deserialized),
Err(error) => {
log::error!("failed to deserialize response from language server: {}. Response from language server: {:?}", error, response);
Err(error).context("failed to deserialize response")
}
}
Err(error) => Err(anyhow!("{}", error.message)),
};
_ = tx.send(response);