pub enum HttpCacheError {
Client(BoxError),
Cache(String),
BadRequest(BadRequest),
Http(BoxError),
Body(BoxError),
Streaming(StreamingError),
Other(BoxError),
}Expand description
Unified error type for HTTP cache operations that works across all client libraries.
This enum consolidates error handling patterns from all http-cache client crates (reqwest, surf, tower, ureq) while providing a clean, extensible interface.
§Examples
use http_cache::{HttpCacheError, BadRequest};
// Cache operation errors
let cache_err = HttpCacheError::cache("Failed to read cache entry");
// Request parsing errors
let request_err = HttpCacheError::from(BadRequest);
// HTTP processing errors
let http_err = HttpCacheError::http("Invalid header format");
// Body processing errors
let body_err = HttpCacheError::body("Failed to collect request body");Variants§
Client(BoxError)
HTTP client error (reqwest, surf, etc.)
Cache(String)
HTTP cache operation failed
BadRequest(BadRequest)
Request parsing failed (e.g., non-cloneable request)
Http(BoxError)
HTTP processing error (header parsing, version handling, etc.)
Body(BoxError)
Body processing error (collection, streaming, etc.)
Streaming(StreamingError)
Streaming operation error (with detailed error kind)
Other(BoxError)
Other generic error
Implementations§
Source§impl HttpCacheError
impl HttpCacheError
Sourcepub fn cache<S: Into<String>>(message: S) -> Self
pub fn cache<S: Into<String>>(message: S) -> Self
Create a cache operation error
§Examples
use http_cache::HttpCacheError;
let err = HttpCacheError::cache("Cache entry not found");Sourcepub fn http<E: Into<BoxError>>(error: E) -> Self
pub fn http<E: Into<BoxError>>(error: E) -> Self
Create an HTTP processing error
§Examples
use http_cache::HttpCacheError;
let err = HttpCacheError::http("Invalid header format");Sourcepub fn body<E: Into<BoxError>>(error: E) -> Self
pub fn body<E: Into<BoxError>>(error: E) -> Self
Create a body processing error
§Examples
use http_cache::HttpCacheError;
let err = HttpCacheError::body("Failed to collect request body");Sourcepub fn client<E: Into<BoxError>>(error: E) -> Self
pub fn client<E: Into<BoxError>>(error: E) -> Self
Create a client error
§Examples
use http_cache::HttpCacheError;
let err = HttpCacheError::client("Network timeout");Sourcepub fn other<E: Into<BoxError>>(error: E) -> Self
pub fn other<E: Into<BoxError>>(error: E) -> Self
Create a generic error
§Examples
use http_cache::HttpCacheError;
let err = HttpCacheError::other("Unexpected error occurred");Sourcepub fn is_cache_error(&self) -> bool
pub fn is_cache_error(&self) -> bool
Returns true if this error is related to cache operations
Sourcepub fn is_client_error(&self) -> bool
pub fn is_client_error(&self) -> bool
Returns true if this error is related to client operations
Sourcepub fn is_streaming_error(&self) -> bool
pub fn is_streaming_error(&self) -> bool
Returns true if this error is related to streaming operations
Sourcepub fn is_bad_request(&self) -> bool
pub fn is_bad_request(&self) -> bool
Returns true if this error is a bad request
Trait Implementations§
Source§impl Debug for HttpCacheError
impl Debug for HttpCacheError
Source§impl Display for HttpCacheError
impl Display for HttpCacheError
Source§impl Error for HttpCacheError
impl Error for HttpCacheError
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
Source§impl From<BadHeader> for HttpCacheError
impl From<BadHeader> for HttpCacheError
Source§impl From<BadRequest> for HttpCacheError
impl From<BadRequest> for HttpCacheError
Source§fn from(error: BadRequest) -> Self
fn from(error: BadRequest) -> Self
Source§impl From<BadVersion> for HttpCacheError
impl From<BadVersion> for HttpCacheError
Source§fn from(error: BadVersion) -> Self
fn from(error: BadVersion) -> Self
Source§impl From<ClientStreamingError> for HttpCacheError
impl From<ClientStreamingError> for HttpCacheError
Source§fn from(error: ClientStreamingError) -> Self
fn from(error: ClientStreamingError) -> Self
Source§impl From<Error> for HttpCacheError
impl From<Error> for HttpCacheError
Source§impl From<Error> for HttpCacheError
impl From<Error> for HttpCacheError
Source§impl From<HttpCacheError> for StreamingError
impl From<HttpCacheError> for StreamingError
Source§fn from(error: HttpCacheError) -> Self
fn from(error: HttpCacheError) -> Self
Source§impl From<InvalidHeaderName> for HttpCacheError
impl From<InvalidHeaderName> for HttpCacheError
Source§fn from(error: InvalidHeaderName) -> Self
fn from(error: InvalidHeaderName) -> Self
Source§impl From<InvalidHeaderValue> for HttpCacheError
impl From<InvalidHeaderValue> for HttpCacheError
Source§fn from(error: InvalidHeaderValue) -> Self
fn from(error: InvalidHeaderValue) -> Self
Source§impl From<InvalidMethod> for HttpCacheError
impl From<InvalidMethod> for HttpCacheError
Source§fn from(error: InvalidMethod) -> Self
fn from(error: InvalidMethod) -> Self
Source§impl From<InvalidStatusCode> for HttpCacheError
impl From<InvalidStatusCode> for HttpCacheError
Source§fn from(error: InvalidStatusCode) -> Self
fn from(error: InvalidStatusCode) -> Self
Source§impl From<InvalidUri> for HttpCacheError
impl From<InvalidUri> for HttpCacheError
Source§fn from(error: InvalidUri) -> Self
fn from(error: InvalidUri) -> Self
Source§impl From<ParseError> for HttpCacheError
impl From<ParseError> for HttpCacheError
Source§fn from(error: ParseError) -> Self
fn from(error: ParseError) -> Self
Source§impl From<StreamingError> for HttpCacheError
impl From<StreamingError> for HttpCacheError
Source§fn from(error: StreamingError) -> Self
fn from(error: StreamingError) -> Self
Auto Trait Implementations§
impl Freeze for HttpCacheError
impl !RefUnwindSafe for HttpCacheError
impl Send for HttpCacheError
impl Sync for HttpCacheError
impl Unpin for HttpCacheError
impl !UnwindSafe for HttpCacheError
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more