pub enum BrainError {
Show 13 variants
Io(Error),
Sqlite(Error),
Json(Error),
BrainNotFound {
path: PathBuf,
},
InvalidBrain {
path: PathBuf,
reason: String,
},
SchemaVersion {
found: u32,
supported: u32,
},
MmapFormat(String),
FtsQuery(String),
FeatureDisabled(&'static str),
Ast(String),
Indexer(String),
Bundle(String),
Other(String),
}Expand description
Error type returned by all public rustbrain-core APIs.
Variants map roughly to subsystems: storage, mmap cache, FTS, indexing, and
portable bundles. Display messages are stable enough for CLI stderr; the
enum itself is not yet #[non_exhaustive] so minor releases may add variants
carefully (consider matching with a wildcard in long-lived apps).
Variants§
Io(Error)
Filesystem or OS I/O failure.
Sqlite(Error)
Underlying SQLite / rusqlite error (constraints, SQL, busy, etc.).
Json(Error)
JSON serialization or deserialization failure (bundles, markers, registry).
BrainNotFound
No .brain/db.sqlite at the expected path (call crate::Brain::create or sync first).
InvalidBrain
.brain exists but is structurally invalid.
SchemaVersion
On-disk schema is newer than this library build (upgrade rustbrain).
Fields
MmapFormat(String)
CSR graph.mmap magic/version/bounds validation failure.
FtsQuery(String)
Empty or illegal full-text query after sanitization.
FeatureDisabled(&'static str)
Called an API that requires a Cargo feature not enabled for this build.
Ast(String)
Tree-sitter / AST extraction failure.
Indexer(String)
Workspace walk / index pipeline failure.
Bundle(String)
Portable .brainbundle export or import failure.
Other(String)
Catch-all for rare internal conditions with a message.
Implementations§
Source§impl BrainError
impl BrainError
Sourcepub fn other(msg: impl Into<String>) -> Self
pub fn other(msg: impl Into<String>) -> Self
Construct an BrainError::Other from any displayable message.
Sourcepub fn mmap(msg: impl Into<String>) -> Self
pub fn mmap(msg: impl Into<String>) -> Self
Construct an BrainError::MmapFormat from any displayable message.
Sourcepub fn indexer(msg: impl Into<String>) -> Self
pub fn indexer(msg: impl Into<String>) -> Self
Construct an BrainError::Indexer from any displayable message.
Sourcepub fn bundle(msg: impl Into<String>) -> Self
pub fn bundle(msg: impl Into<String>) -> Self
Construct an BrainError::Bundle from any displayable message.
Trait Implementations§
Source§impl Debug for BrainError
impl Debug for BrainError
Source§impl Display for BrainError
impl Display for BrainError
Source§impl Error for BrainError
impl Error for BrainError
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()