Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Error Registry

Typed error enums exposed by the SCHEMABOUND public API contract. All fallible operations return typed errors rather than boxed trait objects, enabling precise handling at call sites and clean propagation with ?.

Error TypeOperations CoveredgRPC Status Mapping
MapperErrorQuery dispatch — validate_query, execute_query, mapper construction (InvalidAddress, ConnectionFailed, QueryFailed, ValidationFailed, GrpcTransport)INVALID_ARGUMENT, UNAVAILABLE
ExecutorErrorValidation and execution services — NotConfigured, SchemaParseFailed, ExecutionFailed, TableNotFound, AugmentationFailedFAILED_PRECONDITION, INTERNAL
EngineErrorExecution engine pool and concurrency — Configuration, PoolExhausted, ExecutionFailed, LockFailed, TimeoutRESOURCE_EXHAUSTED, DEADLINE_EXCEEDED
TcpServerErrorJSON-RPC TCP server lifecycle — InvalidAddress, Configuration, ShutdownFailedN/A (non-gRPC)
ControlPlaneErrorWorkflow orchestration — NotFound, ExecutionFailed, CancelledNOT_FOUND, CANCELLED
EventBusErrorHandler and subscriber registration — LockFailedINTERNAL
QuotaErrorRate limiting — RateLimitExceeded, ConnectionLimitExceededRESOURCE_EXHAUSTED
SessionErrorAgent session lifecycle — CleanupFailedINTERNAL
InputScanErrorInjection detection at the gRPC boundaryINVALID_ARGUMENT

All types implement thiserror::Error with stable Display messages. They are designed to map cleanly to gRPC Status codes at the service boundary.

Timeout Constant

All mapper operations share a single timeout constant:

#![allow(unused)]
fn main() {
use schemabound::mapper::DEFAULT_TIMEOUT_SECONDS; // 30
}

This constant governs LocalMapper, TcpMapper, and GrpcMapper connection and request timeouts. Override at the server or client level when your deployment requires different bounds.

Error Propagation Example

#![allow(unused)]
fn main() {
use schemabound::mapper::{LocalMapper, Mapper, DEFAULT_TIMEOUT_SECONDS};
use schemabound::error::MapperError;

async fn run_query(db_path: &str, sql: &str) -> Result<(), MapperError> {
    let mapper = LocalMapper::new(db_path)?;
    mapper.validate_query(sql).await?;
    mapper.execute_query(sql).await?;
    Ok(())
}
}