Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'helix-dap/src/transport.rs')
-rw-r--r--helix-dap/src/transport.rs8
1 files changed, 5 insertions, 3 deletions
diff --git a/helix-dap/src/transport.rs b/helix-dap/src/transport.rs
index 8ca408df..fdd60226 100644
--- a/helix-dap/src/transport.rs
+++ b/helix-dap/src/transport.rs
@@ -125,12 +125,14 @@ impl Transport {
info!("[{}] <- DAP {}", id, msg);
- // try parsing as output (server response) or call (server request)
- let output: serde_json::Result<Payload> = serde_json::from_str(msg);
+ // NOTE: We avoid using `?` here, since it would return early on error
+ // and skip clearing `content`. By returning the result directly instead,
+ // we ensure `content.clear()` is always called.
+ let output = sonic_rs::from_slice(content).map_err(Into::into);
content.clear();
- Ok(output?)
+ output
}
async fn recv_server_error(