feat(error): add Error::is_connect method
				
					
				
			This allows inspecting errors to determine if they are from a client trying to establish a connection (from the `Connect`).
This commit is contained in:
		
							
								
								
									
										12
									
								
								src/error.rs
									
									
									
									
									
								
							
							
						
						
									
										12
									
								
								src/error.rs
									
									
									
									
									
								
							| @@ -97,13 +97,6 @@ pub(crate) enum User { | ||||
| */ | ||||
|  | ||||
| impl Error { | ||||
|     //TODO(error): should there be these kinds of inspection methods? | ||||
|     // | ||||
|     // - is_io() | ||||
|     // - is_connect() | ||||
|     // - is_closed() | ||||
|     // - etc? | ||||
|  | ||||
|     /// Returns true if this was an HTTP parse error. | ||||
|     pub fn is_parse(&self) -> bool { | ||||
|         match self.inner.kind { | ||||
| @@ -139,6 +132,11 @@ impl Error { | ||||
|         self.inner.kind == Kind::Closed | ||||
|     } | ||||
|  | ||||
|     /// Returns true if this was an error from `Connect`. | ||||
|     pub fn is_connect(&self) -> bool { | ||||
|         self.inner.kind == Kind::Connect | ||||
|     } | ||||
|  | ||||
|     /// Returns the error's cause. | ||||
|     /// | ||||
|     /// This is identical to `Error::cause` except that it provides extra | ||||
|   | ||||
		Reference in New Issue
	
	Block a user