Skip to content

Commit 74b86fd

Browse files
pzhan9facebook-github-bot
authored andcommitted
Add error context for debugging
Summary: context would make it easier to track where the error is from. Reviewed By: dulinriley Differential Revision: D75244043 fbshipit-source-id: b05eda65896d0cdd750c0fa24247783f2d6739cc
1 parent 5ad4d24 commit 74b86fd

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

hyperactor/src/channel/net.rs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
//! ```
1919
//!
2020
//! Thus, each socket connection is a sequence of such framed messages.
21+
use std::any::type_name;
2122
use std::collections::VecDeque;
2223
use std::fmt;
2324
use std::fmt::Debug;
@@ -960,7 +961,16 @@ impl<S: AsyncRead + AsyncWrite + Send + 'static + Unpin> ServerConn<S> {
960961
}
961962
}
962963
},
963-
Err(err) => break (next, Err(err.into())),
964+
Err(err) => break (
965+
next,
966+
Err::<(), anyhow::Error>(err.into()).context(
967+
format!(
968+
"error deserializing into Frame with M = {} for data from {:?}",
969+
type_name::<M>(),
970+
self.source,
971+
)
972+
)
973+
),
964974
}
965975
}
966976

0 commit comments

Comments
 (0)