refactor(error): improve organization of Error kinds
- Placed all cases of "unexpected bytes" errors into the `UnexpectedMessage` variant. - Placed all cases of "unexpected EOF" errors into the `IncompleteMessage` variant. Description is now generic about "connection closed before message completed", instead of mentioning "request" or "response. - Added `Error::is_incomplete_message()` accessor to help checking for unexpected closures. - Renamed some variants to be clearer when viewing the `Debug` format. - Collected all "user" errors into an internal `User` enum, to prevent forgetting to update the `is_user()` method.
This commit is contained in:
@@ -103,10 +103,7 @@ fn conn_reset_after_write() {
|
||||
Ok(Async::Ready(()))
|
||||
}).map_err(|e: ::std::io::Error| panic!("srv2 poll_fn error: {}", e));
|
||||
let err = rt.block_on(res2.join(srv2)).expect_err("res2");
|
||||
match err.kind() {
|
||||
&::error::Kind::Incomplete => (),
|
||||
other => panic!("expected Incomplete, found {:?}", other)
|
||||
}
|
||||
assert!(err.is_incomplete_message(), "{:?}", err);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
Reference in New Issue
Block a user