Skip to main content

text_document_common/
error.rs

1// Generated by Qleany v1.4.8 from error.tera
2
3use thiserror::Error;
4
5use crate::types::EntityId;
6
7/// Errors that can occur in the repository / table layer.
8#[derive(Debug, Error)]
9pub enum RepositoryError {
10    /// The underlying database returned an error.
11    #[error(transparent)]
12    Database(#[from] redb::Error),
13
14    /// A table-level operation failed.
15    #[error(transparent)]
16    Table(#[from] redb::TableError),
17
18    /// A storage-level operation failed.
19    #[error(transparent)]
20    Storage(#[from] redb::StorageError),
21
22    /// A transaction operation failed.
23    #[error(transparent)]
24    Transaction(#[from] redb::TransactionError),
25
26    /// A commit operation failed.
27    #[error(transparent)]
28    Commit(#[from] redb::CommitError),
29
30    /// A database-level operation failed.
31    #[error(transparent)]
32    DatabaseOp(#[from] redb::DatabaseError),
33
34    /// An entity with the given id already exists.
35    #[error("{entity} id {id} already in use")]
36    DuplicateId { entity: &'static str, id: EntityId },
37
38    /// A relationship target does not exist.
39    #[error("{operation}: child entities do not exist: {ids:?}")]
40    MissingRelationshipTarget {
41        operation: &'static str,
42        ids: Vec<EntityId>,
43    },
44
45    /// Serialization / deserialization failed.
46    #[error("serialization error: {0}")]
47    Serialization(String),
48}