pub enum RuleCacheError {
Load(Error),
Poisoned,
}Expand description
v0.7.0 #1020 (Agent-1 #6) — typed error for the substrate-public
RuleCache::get_or_load surface. Per CLAUDE.md #964
audit-closure rule, substrate-public APIs MUST use typed errors;
pre-#1020 get_or_load returned anyhow::Result<Arc<Vec<Rule>>>,
leaking the untyped error type across the substrate boundary at a
brand-new (#991) API.
Variants:
RuleCacheError::Loadwraps a downstream load failure fromcrate::governance::rules_store::list_enabled_by_kind. The inneranyhow::Errorpreserves the rusqlite + context chain for diagnostics; downstream code paths that need the chain call.0directly orFrom::<RuleCacheError>::frominto their own anyhow surface.RuleCacheError::Poisonedsurfaces anRwLockpoison — previously swallowed with a silent fallback to the freshly-loaded snapshot. Surfacing it lets callers decide whether to refuse, retry, or rebuild the cache.
Variants§
Load(Error)
list_enabled_by_kind failed (rusqlite error or downstream
signature-verification panic).
Poisoned
The inner RwLock is poisoned (another thread panicked
while holding it). The legacy fallback returned the freshly-
loaded snapshot; callers can still do so via
RuleCacheError::is_poisoned but the typed signal lets
observability paths surface the panic.
Implementations§
Source§impl RuleCacheError
impl RuleCacheError
Sourcepub fn is_poisoned(&self) -> bool
pub fn is_poisoned(&self) -> bool
Returns true for the RuleCacheError::Poisoned variant.
Callers that want the legacy “silent fallback” posture can
branch on this to recover the freshly-loaded snapshot from
a parallel list_enabled_by_kind call.
Trait Implementations§
Source§impl Debug for RuleCacheError
impl Debug for RuleCacheError
Source§impl Display for RuleCacheError
impl Display for RuleCacheError
Source§impl Error for RuleCacheError
impl Error for RuleCacheError
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 RuleCacheError
impl RefUnwindSafe for RuleCacheError
impl Send for RuleCacheError
impl Sync for RuleCacheError
impl Unpin for RuleCacheError
impl UnsafeUnpin for RuleCacheError
impl UnwindSafe for RuleCacheError
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> ErasedDestructor for Twhere
T: 'static,
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> Pointable for T
impl<T> Pointable for T
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<T> ToCompactString for Twhere
T: Display,
impl<T> ToCompactString for Twhere
T: Display,
Source§fn try_to_compact_string(&self) -> Result<CompactString, ToCompactStringError>
fn try_to_compact_string(&self) -> Result<CompactString, ToCompactStringError>
ToCompactString::to_compact_string() Read moreSource§fn to_compact_string(&self) -> CompactString
fn to_compact_string(&self) -> CompactString
CompactString. Read moreSource§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.