pub struct TokenLifecycleError {
pub reason: InvalidationReason,
pub message: String,
}Expand description
Errors returned by
TokenValidator
when it rejects a token submission.
Carries the structured InvalidationReason (which itself
embeds the vendor family + challenge class) and a short
human-readable message suitable for operator logs. The
diagnostic payload the runner exposes can switch on the
InvalidationReason::kind
tag to route the failure into the correct per-family audit
log.
Fields§
§reason: InvalidationReasonStructured reason the validator rejected the token.
message: StringHuman-readable message suitable for operator logs.
Implementations§
Source§impl TokenLifecycleError
impl TokenLifecycleError
Sourcepub fn new(reason: InvalidationReason, message: impl Into<String>) -> Self
pub fn new(reason: InvalidationReason, message: impl Into<String>) -> Self
Build a TokenLifecycleError from a reason + a
human-readable message.
§Example
use stygian_charon::token_lifecycle::{
ChallengeClass, InvalidationReason, TokenLifecycleError,
};
use stygian_charon::vendor_classifier::VendorId;
let err = TokenLifecycleError::new(
InvalidationReason::Expired {
vendor: VendorId::Cloudflare,
challenge_class: ChallengeClass::Interstitial,
age_secs: 1900,
ttl_secs: 1800,
},
"Cloudflare token expired",
);
assert_eq!(err.message, "Cloudflare token expired");
assert_eq!(err.reason.vendor_family(), VendorId::Cloudflare);Sourcepub const fn vendor_family(&self) -> VendorId
pub const fn vendor_family(&self) -> VendorId
Vendor family the error is attributed to.
Trait Implementations§
Source§impl Clone for TokenLifecycleError
impl Clone for TokenLifecycleError
Source§fn clone(&self) -> TokenLifecycleError
fn clone(&self) -> TokenLifecycleError
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for TokenLifecycleError
impl Debug for TokenLifecycleError
Source§impl Display for TokenLifecycleError
impl Display for TokenLifecycleError
Source§impl Error for TokenLifecycleError
impl Error for TokenLifecycleError
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
👎Deprecated since 1.42.0:
use the Display impl or to_string()
Source§impl PartialEq for TokenLifecycleError
impl PartialEq for TokenLifecycleError
impl Eq for TokenLifecycleError
impl StructuralPartialEq for TokenLifecycleError
Auto Trait Implementations§
impl Freeze for TokenLifecycleError
impl RefUnwindSafe for TokenLifecycleError
impl Send for TokenLifecycleError
impl Sync for TokenLifecycleError
impl Unpin for TokenLifecycleError
impl UnsafeUnpin for TokenLifecycleError
impl UnwindSafe for TokenLifecycleError
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.