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 Type | Operations Covered | gRPC Status Mapping |
|---|---|---|
MapperError | Query dispatch — validate_query, execute_query, mapper construction (InvalidAddress, ConnectionFailed, QueryFailed, ValidationFailed, GrpcTransport) | INVALID_ARGUMENT, UNAVAILABLE |
ExecutorError | Validation and execution services — NotConfigured, SchemaParseFailed, ExecutionFailed, TableNotFound, AugmentationFailed | FAILED_PRECONDITION, INTERNAL |
EngineError | Execution engine pool and concurrency — Configuration, PoolExhausted, ExecutionFailed, LockFailed, Timeout | RESOURCE_EXHAUSTED, DEADLINE_EXCEEDED |
TcpServerError | JSON-RPC TCP server lifecycle — InvalidAddress, Configuration, ShutdownFailed | N/A (non-gRPC) |
ControlPlaneError | Workflow orchestration — NotFound, ExecutionFailed, Cancelled | NOT_FOUND, CANCELLED |
EventBusError | Handler and subscriber registration — LockFailed | INTERNAL |
QuotaError | Rate limiting — RateLimitExceeded, ConnectionLimitExceeded | RESOURCE_EXHAUSTED |
SessionError | Agent session lifecycle — CleanupFailed | INTERNAL |
InputScanError | Injection detection at the gRPC boundary | INVALID_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(())
}
}