Repository navigation
Replies: 1 comment
|
None of the Body errors When your hyper/src/proto/h1/dispatch.rs Lines 372 to 378 in 621d8e4 which sets Lines 394 to 396 in 621d8e4 and Lines 193 to 195 in 621d8e4 Peer reset An I/O failure on the socket (reset, broken pipe, etc.) goes through Lines 316 to 318 in 621d8e4 That's just Lines 536 to 542 in 621d8e4 so you can downcast it back to use std::error::Error as _;
fn log_conn_error(error: &hyper::Error) {
if error.is_user() {
// came from your Body impl (is_user() also covers Service etc.,
// but in a serve_connection future this is effectively "your Body")
warn!("body error: {error}");
return;
}
if let Some(io_err) = error.source().and_then(|s| s.downcast_ref::<std::io::Error>()) {
if io_err.kind() == std::io::ErrorKind::ConnectionReset {
debug!("peer reset the connection");
return;
}
}
warn!("connection error: {error}");
}
|
Uh oh!
There was an error while loading. Please reload this page.
“Cargo.toml”:
When a peer resets the connection,
errorishyper::Error(Io, Os { code: 104, kind: ConnectionReset, message: "Connection reset by peer" }). I suppose thaterrorin the code above may be also an error returned by my implementation of thehyper::body::Bodytrait. I would like to distinguish body errors and when a peer resets a connection to log these error with different log levels.However, all
is_*methods ofhyper::Errorreturnfalse. Shouldn't one of the below methodsis_body_write_abortedis_canceledis_closedreturn
true?All reactions