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:
		| @@ -31,8 +31,21 @@ pub(crate) trait Http1Transaction { | ||||
|  | ||||
|     fn on_error(err: &::Error) -> Option<MessageHead<Self::Outgoing>>; | ||||
|  | ||||
|     fn should_error_on_parse_eof() -> bool; | ||||
|     fn should_read_first() -> bool; | ||||
|     fn is_client() -> bool { | ||||
|         !Self::is_server() | ||||
|     } | ||||
|  | ||||
|     fn is_server() -> bool { | ||||
|         !Self::is_client() | ||||
|     } | ||||
|  | ||||
|     fn should_error_on_parse_eof() -> bool { | ||||
|         Self::is_client() | ||||
|     } | ||||
|  | ||||
|     fn should_read_first() -> bool { | ||||
|         Self::is_server() | ||||
|     } | ||||
|  | ||||
|     fn update_date() {} | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user