kb/error.rs
1//! Error types for the kb crate.
2
3use thiserror::Error;
4
5/// Errors that can occur in kb operations.
6#[derive(Debug, Error)]
7pub enum KbError {
8 /// A database operation failed.
9 #[error("database error: {0}")]
10 Database(#[from] rusqlite::Error),
11
12 /// A node was not found.
13 #[error("not found: {0}")]
14 NotFound(String),
15
16 /// An I/O operation failed.
17 #[error("I/O error: {0}")]
18 Io(#[from] std::io::Error),
19
20 /// A stored `ast_blob` failed to decode, attributed to the owning node.
21 #[error("corrupt ast_blob for node {node_id}: {reason}")]
22 CorruptAstBlob {
23 /// Id of the node whose blob failed to decode.
24 node_id: String,
25 /// Decoder failure detail (display only).
26 reason: String,
27 },
28}