#[non_exhaustive]pub enum GuardError {
Timeout,
DeadlineViolated,
Panicked(String),
Internal(String),
Dependency(String),
}Expand description
Something went wrong while evaluating a guard.
A GuardError means the guard did not decide — it is not a decision to
block. Conflating “the check failed” with “the check says no” is how a
broken dependency becomes a silent hole. Blocking is Verdict::Block;
failing is this, resolved by the guard’s own FailPolicy.
#[non_exhaustive]: match with a wildcard arm, since new failure modes
may arrive in a minor release.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Timeout
The guard did not finish within its declared Guard::timeout.
For a non-strict guard this is best-effort: the pipeline stops
waiting, but the work may still be running. See
docs/RELIABILITY.md.
DeadlineViolated
A strict guard blew through its deadline.
Unlike GuardError::Timeout, this reports a contract violation: a
Guard::strict guard promised to consult the deadline and return on
its own. Produced by the pipeline, not by guard authors.
Panicked(String)
The guard panicked and the pipeline caught it. Carries the panic message where one could be recovered.
Produced by the pipeline, not by guard authors — deliberate failures
should be GuardError::Internal.
Internal(String)
The guard’s own logic failed: a malformed rule, an impossible state, a config error found at check time.
Dependency(String)
Something the guard relies on failed: a datastore, a model endpoint.
Separate from GuardError::Internal because the operational
response differs — a bug in the guard versus an outage elsewhere — and
because this is the variant worth retrying.
Implementations§
Source§impl GuardError
impl GuardError
Sourcepub fn panicked(message: impl Into<String>) -> Self
pub fn panicked(message: impl Into<String>) -> Self
Builds a GuardError::Panicked from anything string-like.
Prefer letting the pipeline produce this. Guard authors should return
GuardError::Internal for deliberate failures.
Sourcepub fn internal(message: impl Into<String>) -> Self
pub fn internal(message: impl Into<String>) -> Self
Builds a GuardError::Internal from anything string-like.
Sourcepub fn dependency(message: impl Into<String>) -> Self
pub fn dependency(message: impl Into<String>) -> Self
Builds a GuardError::Dependency from anything string-like.
Sourcepub fn is_timeout(&self) -> bool
pub fn is_timeout(&self) -> bool
Returns true for both the soft (GuardError::Timeout) and hard
(GuardError::DeadlineViolated) time failures.
Trait Implementations§
Source§impl Clone for GuardError
impl Clone for GuardError
Source§impl Debug for GuardError
impl Debug for GuardError
Source§impl Display for GuardError
impl Display for GuardError
impl Eq for GuardError
Source§impl Error for GuardError
impl Error for GuardError
1.30.0 · 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()