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:
@@ -708,7 +708,7 @@ where
|
||||
Ok(Async::NotReady) => return Ok(Async::NotReady),
|
||||
Err(e) => {
|
||||
trace!("make_service closed");
|
||||
return Err(::Error::new_user_new_service(e));
|
||||
return Err(::Error::new_user_make_service(e));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -876,8 +876,8 @@ pub(crate) mod spawn_all {
|
||||
let conn = try_ready!(connecting
|
||||
.poll()
|
||||
.map_err(|err| {
|
||||
let err = ::Error::new_user_new_service(err);
|
||||
debug!("connection error: {}", err);
|
||||
let err = ::Error::new_user_make_service(err);
|
||||
debug!("connecting error: {}", err);
|
||||
}));
|
||||
let connected = watcher.watch(conn.with_upgrades());
|
||||
State::Connected(connected)
|
||||
|
||||
Reference in New Issue
Block a user