#[non_exhaustive]pub enum PipelineError {
BadRequest {
context: String,
source: Option<ErrorSource>,
},
Unauthorized(String),
Blocked {
context: String,
source: Option<ErrorSource>,
},
Upstream {
context: String,
source: Option<ErrorSource>,
},
UpstreamTimeout {
context: String,
source: Option<ErrorSource>,
},
Abort(String),
Unavailable {
context: String,
source: Option<ErrorSource>,
},
}Expand description
Hot-path failures, each carrying an HTTP status mapping.
Variants that wrap an underlying failure carry it as a typed
#[source] instead of a pre-rendered String; context keeps the
exact text the old String payloads rendered, so Display output
(embedded verbatim in the OpenAI-shaped HTTP error bodies) is
unchanged. Unauthorized and Abort stay plain strings: their
messages are deliberately classified policy verdicts (the raw
identity error is logged separately and must not travel with the
client-facing value).
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
BadRequest
A request header was malformed or inconsistent.
Fields
source: Option<ErrorSource>Underlying typed error, when one exists.
Identity was missing or invalid.
Blocked
A stateful quota or loop breaker blocked execution.
Fields
source: Option<ErrorSource>Underlying typed error, when one exists.
Upstream
The upstream provider request failed.
Fields
source: Option<ErrorSource>Underlying typed error, when one exists.
UpstreamTimeout
The upstream provider accepted the connection but did not
finish responding within upstream_read_timeout_s. Distinct
from Self::Upstream so the response layer can map to
504 Gateway Timeout (RFC 7231 §6.6.5) rather than
502 Bad Gateway, letting operator dashboards distinguish
“provider slow” (504 — check provider health) from
“provider unreachable” (502 — check DNS / network / config).
SDK retry behaviour is unchanged (both retryable).
Fields
source: Option<ErrorSource>Underlying typed error, when one exists.
Abort(String)
The breaker requested immediate connection closure.
Required audit capture infrastructure is unavailable.
Implementations§
Source§impl PipelineError
impl PipelineError
Sourcepub fn bad_request(context: impl Into<String>) -> Self
pub fn bad_request(context: impl Into<String>) -> Self
Semantic bad-request refusal with no underlying typed error.
Sourcepub fn bad_request_source<E>(error: E) -> Self
pub fn bad_request_source<E>(error: E) -> Self
Bad request caused by a typed error. The error text is kept in
context so Display matches the old stringified payload, while
the value itself stays reachable via Error::source().
Sourcepub fn blocked(context: impl Into<String>) -> Self
pub fn blocked(context: impl Into<String>) -> Self
Semantic policy block with no underlying typed error.
Sourcepub fn blocked_source<E>(error: E) -> Self
pub fn blocked_source<E>(error: E) -> Self
Block caused by a typed error (see Self::bad_request_source).
Sourcepub fn upstream(context: impl Into<String>) -> Self
pub fn upstream(context: impl Into<String>) -> Self
Semantic upstream failure with no underlying typed error.
Sourcepub fn upstream_source<E>(error: E) -> Self
pub fn upstream_source<E>(error: E) -> Self
Upstream failure caused by a typed error (see
Self::bad_request_source).
Sourcepub fn upstream_timeout(context: impl Into<String>) -> Self
pub fn upstream_timeout(context: impl Into<String>) -> Self
Semantic upstream-timeout failure with no underlying typed
error. Response layer maps this to 504 Gateway Timeout
(see Self::UpstreamTimeout docs).
Semantic unavailability with no underlying typed error.
Unavailability caused by a typed error (see
Self::bad_request_source).
Sourcepub fn status(&self) -> StatusCode
pub fn status(&self) -> StatusCode
HTTP status code corresponding to this failure.
Blocked/Abortare permanent policy verdicts for the current session: 403 / 409 stop mainstream SDK auto-retry loops that would otherwise interpret 429 as transient rate limiting and burn budget re-hitting the same breaker.Unavailableis transient: 503 is paired withRetry-Afterat the response layer so intermediaries and clients back off in bounded fashion (RFC 7231 §7.1.3).Unauthorizedis paired withWWW-Authenticateat the response layer (RFC 7235 §3.1).
Trait Implementations§
Source§impl Debug for PipelineError
impl Debug for PipelineError
Source§impl Display for PipelineError
impl Display for PipelineError
Source§impl Error for PipelineError
impl Error for PipelineError
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 Freeze for PipelineError
impl !RefUnwindSafe for PipelineError
impl Send for PipelineError
impl Sync for PipelineError
impl Unpin for PipelineError
impl UnsafeUnpin for PipelineError
impl !UnwindSafe for PipelineError
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
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> DowncastSend for T
impl<T> DowncastSend for T
§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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 more§impl<T> Pointable for T
impl<T> Pointable for T
§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
§impl<T> ToCompactString for Twhere
T: Display,
impl<T> ToCompactString for Twhere
T: Display,
§fn try_to_compact_string(&self) -> Result<CompactString, ToCompactStringError>
fn try_to_compact_string(&self) -> Result<CompactString, ToCompactStringError>
ToCompactString::to_compact_string()] Read more§fn to_compact_string(&self) -> CompactString
fn to_compact_string(&self) -> CompactString
CompactString]. Read more