BREAKING CHANGE(core): replace the TypeScript database engine with a Rust-backed embedded server and bridge

This commit is contained in:
2026-03-26 19:48:27 +00:00
parent 8ec2046908
commit e23a951dbe
106 changed files with 11567 additions and 10678 deletions

View File

@@ -0,0 +1,35 @@
use thiserror::Error;
/// Errors that can occur during transaction or session operations.
#[derive(Debug, Error)]
pub enum TransactionError {
#[error("not found: {0}")]
NotFound(String),
#[error("transaction already active for session: {0}")]
AlreadyActive(String),
#[error("write conflict detected (code 112): {0}")]
WriteConflict(String),
#[error("session expired: {0}")]
SessionExpired(String),
#[error("invalid transaction state: {0}")]
InvalidState(String),
}
impl TransactionError {
/// Returns the error code.
pub fn code(&self) -> i32 {
match self {
TransactionError::NotFound(_) => 251,
TransactionError::AlreadyActive(_) => 256,
TransactionError::WriteConflict(_) => 112,
TransactionError::SessionExpired(_) => 6100,
TransactionError::InvalidState(_) => 263,
}
}
}
pub type TransactionResult<T> = Result<T, TransactionError>;