Skip to content

Commit

Permalink
DAP: Add request ID to request timeout message (#6018)
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.
  • Loading branch information
xiaoma20082008 authored Feb 16, 2023
1 parent 78a1e2d commit ce0837d
Show file tree
Hide file tree
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
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions helix-dap/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand Down

0 comments on commit ce0837d

Please sign in to comment.