pub enum OriginError {
UnsupportedEncoding {
encoding: Box<str>,
},
MalformedEncoding,
DecompressionFailed {
encoding: SupportedEncoding,
source: Error,
},
}Expand description
Errors raised by the crate::origin::HttpOrigin decompression layer.
Surfaced to the engine through the anyhow::Error source on
CacheError::OriginError (the Origin trait returns anyhow::Result).
Use CacheError::origin_error_kind to recover the typed variant —
the chain walk works through any number of with_context wrappers.
Variants§
UnsupportedEncoding
The response advertised a Content-Encoding value the origin layer
does not understand. We refuse to silently pass the bytes through —
the BLAKE3 verify in the engine would fail, but with a confusing
“hash mismatch” message rather than a precise “your origin is using
an encoding I don’t support” message.
encoding is Box<str> rather than String to keep the variant
16 bytes on a 64-bit target — error enums get cloned/passed
around the chain a lot, and the underlying buffer is never
resized after construction.
MalformedEncoding
The response carried a non-ASCII Content-Encoding byte sequence
that we refuse to interpret. RFC 9110 § 5.6.7 restricts coding
names to ASCII tokens; treating an arbitrary byte sequence as
“no encoding” would silently pass through what may be a real
(mis-cased / mis-typed) compression directive.
DecompressionFailed
Decompression of the response body failed mid-stream. Either the
origin sent a corrupt payload or an encoding mismatch slipped past
the header check (e.g. Content-Encoding: gzip but the bytes are
actually zstd). The encoding field is typed (closed set) so
nonsense values are unrepresentable — this variant is reachable
only from the gzip and zstd code paths.
Fields
encoding: SupportedEncodingThe supported encoding whose decoder rejected the body.
Trait Implementations§
Source§impl Debug for OriginError
impl Debug for OriginError
Source§impl Display for OriginError
impl Display for OriginError
Source§impl Error for OriginError
impl Error for OriginError
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
use the Display impl or to_string()
Auto Trait Implementations§
impl !RefUnwindSafe for OriginError
impl !UnwindSafe for OriginError
impl Freeze for OriginError
impl Send for OriginError
impl Sync for OriginError
impl Unpin for OriginError
impl UnsafeUnpin for OriginError
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> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
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 moreSource§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<T> ToStringFallible for Twhere
T: Display,
impl<T> ToStringFallible for Twhere
T: Display,
Source§fn try_to_string(&self) -> Result<String, TryReserveError>
fn try_to_string(&self) -> Result<String, TryReserveError>
ToString::to_string, but without panic on OOM.