guardian-db 0.19.0

High-performance, local-first decentralized database built on Rust and Iroh
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
//! Error handling. We reuse [`crate::relational::RelError`] (which carries
//! SQLSTATE codes) as the engine error type and add a parser-error mapping.

pub use crate::relational::RelError as SqlError;
pub type Result<T> = std::result::Result<T, SqlError>;

/// Map a sqlparser error into a SQLSTATE-tagged syntax error.
pub fn parse_error(e: sqlparser::parser::ParserError) -> SqlError {
    SqlError::Syntax(e.to_string())
}

/// Shorthand for an unsupported-feature error.
pub fn unsupported(what: impl Into<String>) -> SqlError {
    SqlError::FeatureNotSupported(what.into())
}