error.rs 990 B

123456789101112131415161718192021222324252627
  1. //! Error types for storage implementations.
  2. /// Errors produced by [`Store`](crate::store::Store) implementations.
  3. ///
  4. /// The store is a dumb instruction follower: writes report affected-row counts,
  5. /// not semantic verdicts, so there are no "posting not active"/"reservation
  6. /// mismatch"/"cas conflict"/"already exists"/"version conflict" variants — every
  7. /// caller derives those from counts. The only outcomes a write can report are a
  8. /// count and an I/O fault.
  9. #[derive(Debug, Clone)]
  10. pub enum StoreError {
  11. /// The requested entity was not found.
  12. NotFound(String),
  13. /// Catch-all for unexpected internal errors.
  14. Internal(String),
  15. }
  16. impl std::fmt::Display for StoreError {
  17. fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
  18. match self {
  19. Self::NotFound(msg) => write!(f, "not found: {msg}"),
  20. Self::Internal(msg) => write!(f, "internal error: {msg}"),
  21. }
  22. }
  23. }
  24. impl std::error::Error for StoreError {}