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:
Sean McArthur
2019-04-25 15:47:38 -07:00
parent 4133181bb2
commit 271bba1667
15 changed files with 213 additions and 211 deletions

View File

@@ -549,7 +549,7 @@ test! {
method: GET,
url: "http://{addr}/err",
},
error: |err| err.to_string() == "parsed HTTP message from remote is incomplete",
error: |err| err.is_incomplete_message(),
}
test! {