DAP: Add request ID to request timeout message (#6018)
This improves error logging for dap requests. Without the ID
it's hard to know which request is the one that timed out.
commitce0837dbb75badf39c9b1ac251fba9c3efbc57c4
authorxiaoma20082008 <chunxiao_ma@outlook.com>
dateFri 17 Feb 2023, 00:21 (4 years ago)
parent78a1e2d
helix-dap/src/client.rs+1−1
@@ -254,7 +254,7 @@ impl Client {
254254 // TODO: specifiable timeout, delay other calls until initialize success
255255 timeout(Duration::from_secs(20), callback_rx.recv())
256256 .await
257− .map_err(|_| Error::Timeout)? // return Timeout
257+ .map_err(|_| Error::Timeout(id))? // return Timeout
258258 .ok_or(Error::StreamClosed)?
259259 .map(|response| response.body.unwrap_or_default())
260260 // TODO: check response.success
helix-dap/src/lib.rs+2−2
@@ -14,8 +14,8 @@ pub enum Error {
1414 Parse(#[from] serde_json::Error),
1515 #[error("IO Error: {0}")]
1616 IO(#[from] std::io::Error),
17− #[error("request timed out")]
18− Timeout,
17+ #[error("request {0} timed out")]
18+ Timeout(u64),
1919 #[error("server closed the stream")]
2020 StreamClosed,
2121 #[error(transparent)]