sqlite_knowledge_graph/
error.rs1use thiserror::Error;
4
5pub type Result<T> = std::result::Result<T, Error>;
6
7#[derive(Error, Debug)]
8pub enum Error {
9 #[error("SQLite error: {0}")]
10 SQLite(#[from] rusqlite::Error),
11
12 #[error("JSON error: {0}")]
13 Json(#[from] serde_json::Error),
14
15 #[error("IO error: {0}")]
16 Io(#[from] std::io::Error),
17
18 #[error("Entity not found: {0}")]
19 EntityNotFound(i64),
20
21 #[error("Relation not found: {0}")]
22 RelationNotFound(i64),
23
24 #[error("Invalid vector dimension: expected {expected}, got {actual}")]
25 InvalidVectorDimension { expected: usize, actual: usize },
26
27 #[error("Invalid depth: {0}")]
28 InvalidDepth(u32),
29
30 #[error("Invalid weight: {0}")]
31 InvalidWeight(f64),
32
33 #[error("Invalid arity: {0} (minimum 2 entities required)")]
34 InvalidArity(usize),
35
36 #[error("Hyperedge not found: {0}")]
37 HyperedgeNotFound(i64),
38
39 #[error("Invalid entity type: {0}")]
40 InvalidEntityType(String),
41
42 #[error("Invalid input: {0}")]
43 InvalidInput(String),
44
45 #[error("Database is closed")]
46 DatabaseClosed,
47
48 #[error("Other error: {0}")]
49 Other(String),
50}