Skip to main content

rig_memory_policy/
error.rs

1//! Neutral error type for `rig-memory-policy` helpers.
2
3use thiserror::Error;
4
5/// Errors produced by [`crate::dedup`] and other policy helpers.
6///
7/// New variants are additive. The enum is `#[non_exhaustive]` so future
8/// helpers can extend it without a breaking change.
9#[derive(Debug, Error)]
10#[non_exhaustive]
11pub enum PolicyError {
12    /// Direct lookup against an unknown entry key.
13    #[error("entry not found: {0}")]
14    NotFound(String),
15
16    /// An internal lock was poisoned by a previous panic. The affected
17    /// instance should be discarded.
18    #[error("internal lock poisoned")]
19    Poisoned,
20}