Skip to main content

meshdb_storage/
error.rs

1use meshdb_core::{EdgeId, NodeId};
2use thiserror::Error;
3
4#[derive(Debug, Error)]
5pub enum Error {
6    #[error("rocksdb: {0}")]
7    RocksDb(#[from] rocksdb::Error),
8
9    #[error("serialization: {0}")]
10    Serde(#[from] serde_json::Error),
11
12    #[error("core: {0}")]
13    Core(#[from] meshdb_core::Error),
14
15    #[error("missing column family: {0}")]
16    MissingColumnFamily(&'static str),
17
18    #[error("corrupt bytes in {cf}: expected {expected}, got {actual}")]
19    CorruptBytes {
20        cf: &'static str,
21        expected: usize,
22        actual: usize,
23    },
24
25    #[error("node not found: {0}")]
26    NodeNotFound(NodeId),
27
28    #[error("edge not found: {0}")]
29    EdgeNotFound(EdgeId),
30
31    #[error("property {property} of type {kind} is not indexable")]
32    UnindexableValue {
33        property: String,
34        kind: &'static str,
35    },
36}
37
38pub type Result<T> = std::result::Result<T, Error>;