Skip to main content

claw_store/
error.rs

1use std::path::PathBuf;
2use thiserror::Error;
3
4#[derive(Debug, Error)]
5pub enum StoreError {
6    #[error("not a claw repository: {0}")]
7    NotARepository(PathBuf),
8    #[error("object not found: {0}")]
9    ObjectNotFound(claw_core::id::ObjectId),
10    #[error("ref not found: {0}")]
11    RefNotFound(String),
12    #[error("lock contention on {0}")]
13    LockContention(PathBuf),
14    #[error("io error: {0}")]
15    Io(#[from] std::io::Error),
16    #[error("core error: {0}")]
17    Core(#[from] claw_core::CoreError),
18    #[error("config error: {0}")]
19    Config(String),
20    #[error("index error: {0}")]
21    Index(String),
22    #[error("ref CAS conflict: expected {expected}, actual {actual}")]
23    RefCasConflict { expected: String, actual: String },
24    #[error("invalid ref name: {0}")]
25    InvalidRefName(String),
26    #[error("ref path escapes refs root: {0}")]
27    RefPathEscapesRoot(PathBuf),
28}