Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
DAP: Add request ID to request timeout message
Browse files Browse the repository at this point in the history
This improves error logging for dap requests. Without the ID
it's hard to know which request is the one that timed out.
xiaoma20082008 committed Feb 16, 2023
1 parent 9368ac7 commit c7de88e
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion helix-dap/src/client.rs
Original file line number Diff line number Diff line change
@@ -254,7 +254,7 @@ impl Client {
// TODO: specifiable timeout, delay other calls until initialize success
timeout(Duration::from_secs(20), callback_rx.recv())
.await
.map_err(|_| Error::Timeout)? // return Timeout
.map_err(|_| Error::Timeout(id))? // return Timeout
.ok_or(Error::StreamClosed)?
.map(|response| response.body.unwrap_or_default())
// TODO: check response.success
4 changes: 2 additions & 2 deletions helix-dap/src/lib.rs
Original file line number Diff line number Diff line change
@@ -14,8 +14,8 @@ pub enum Error {
Parse(#[from] serde_json::Error),
#[error("IO Error: {0}")]
IO(#[from] std::io::Error),
#[error("request timed out")]
Timeout,
#[error("request {0} timed out")]
Timeout(u64),
#[error("server closed the stream")]
StreamClosed,
#[error(transparent)]

0 comments on commit c7de88e

Please sign in to comment.