Skip to main content

issundb_core/
error.rs

1use thiserror::Error;
2
3#[derive(Debug, Error)]
4pub enum Error {
5    #[error("storage: {0}")]
6    Storage(#[from] crate::storage::StorageError),
7
8    #[error("encode: {0}")]
9    Encode(#[from] rmp_serde::encode::Error),
10
11    #[error("decode: {0}")]
12    Decode(#[from] rmp_serde::decode::Error),
13
14    #[error("node {0} not found")]
15    NodeNotFound(u64),
16
17    #[error("edge {0} not found")]
18    EdgeNotFound(u64),
19
20    #[error("corrupt storage: {0}")]
21    Corrupt(&'static str),
22
23    #[error("invalid argument: {0}")]
24    InvalidArgument(String),
25
26    #[error("io: {0}")]
27    Io(#[from] std::io::Error),
28
29    #[error("vector index: {0}")]
30    Vector(String),
31
32    #[error(
33        "unique constraint violation: node/edge with label/type {0} already has property '{1}' with value {2}"
34    )]
35    UniqueConstraintViolation(String, String, String),
36
37    #[error(
38        "required constraint violation: node/edge with label/type {0} is missing required property '{1}'"
39    )]
40    RequiredConstraintViolation(String, String),
41}