pub enum DbError {
Show 29 variants
ConnectionFailed {
endpoint: String,
reason: String,
},
BufferFull {
size: u32,
buffer_name: String,
},
BufferLagged {
lag_count: u64,
buffer_name: String,
},
BufferClosed {
buffer_name: String,
},
BufferEmpty,
RecordNotFound {
record_name: String,
},
RecordKeyNotFound {
key: String,
},
InvalidRecordId {
id: u32,
},
TypeMismatch {
record_id: u32,
expected_type: String,
},
AmbiguousType {
count: u32,
type_name: String,
},
DuplicateRecordKey {
key: String,
},
InvalidOperation {
operation: String,
reason: String,
},
PermissionDenied {
operation: String,
},
MissingConfiguration {
parameter: String,
},
RuntimeError {
message: String,
},
ResourceUnavailable {
resource_type: u8,
resource_name: String,
},
HardwareError {
component: u8,
error_code: u16,
description: String,
},
Internal {
code: u32,
message: String,
},
AttachFailed {
message: String,
},
DetachFailed {
message: String,
},
SetTimeout,
GetTimeout,
RuntimeShutdown,
CyclicDependency {
records: Vec<String>,
},
TransformInputNotFound {
output_key: String,
input_key: String,
},
Io {
source: Error,
},
IoWithContext {
context: String,
source: Error,
},
Json {
source: Error,
},
JsonWithContext {
context: String,
source: Error,
},
}Expand description
Streamlined error type for AimDB operations
Only includes errors that are actually used in the codebase, removing theoretical/unused error variants for simplicity.
Variants§
ConnectionFailed
Connection or timeout failures
BufferFull
Buffer is full and cannot accept more items
BufferLagged
Consumer lagged behind producer (SPMC ring buffers)
BufferClosed
Buffer channel has been closed (shutdown)
BufferEmpty
Non-blocking receive found no pending values
RecordNotFound
Record type not found in database (legacy, by type name)
RecordKeyNotFound
Record key not found in registry
InvalidRecordId
RecordId out of bounds or invalid
TypeMismatch
Type mismatch when accessing record by ID
AmbiguousType
Multiple records of same type exist (ambiguous type-only lookup)
DuplicateRecordKey
Duplicate record key during registration
InvalidOperation
Invalid operation attempted
PermissionDenied
Permission denied for operation
MissingConfiguration
Missing required configuration parameter
RuntimeError
Runtime execution error (task spawning, scheduling, etc.)
Resource temporarily unavailable (used by adapters)
HardwareError
Hardware-specific errors for embedded/MCU environments
Internal
Internal error for unexpected conditions
AttachFailed
Failed to attach database to runtime thread
DetachFailed
Failed to detach database from runtime thread
SetTimeout
Timeout while setting a value
GetTimeout
Timeout while getting a value
RuntimeShutdown
Runtime thread has shut down
CyclicDependency
Transform dependency graph contains a cycle
TransformInputNotFound
Transform input key references a record that was not registered
Io
I/O operation error
IoWithContext
I/O operation error with context
Json
JSON serialization error
JsonWithContext
JSON serialization error with context
Implementations§
Source§impl DbError
impl DbError
pub const RESOURCE_TYPE_MEMORY: u8 = 0
pub const RESOURCE_TYPE_FILE_HANDLE: u8 = 1
pub const RESOURCE_TYPE_SOCKET: u8 = 2
pub const RESOURCE_TYPE_BUFFER: u8 = 3
pub const RESOURCE_TYPE_THREAD: u8 = 4
pub const RESOURCE_TYPE_MUTEX: u8 = 5
pub const RESOURCE_TYPE_SEMAPHORE: u8 = 6
pub const RESOURCE_TYPE_CHANNEL: u8 = 7
pub const RESOURCE_TYPE_WOULD_BLOCK: u8 = 255
Sourcepub fn hardware_error(component: u8, error_code: u16) -> Self
pub fn hardware_error(component: u8, error_code: u16) -> Self
Creates a hardware error for embedded environments
Sourcepub fn is_network_error(&self) -> bool
pub fn is_network_error(&self) -> bool
Returns true if this is a network-related error
Sourcepub fn is_capacity_error(&self) -> bool
pub fn is_capacity_error(&self) -> bool
Returns true if this is a capacity-related error
Sourcepub fn is_hardware_error(&self) -> bool
pub fn is_hardware_error(&self) -> bool
Returns true if this is a hardware-related error
Sourcepub const fn error_code(&self) -> u32
pub const fn error_code(&self) -> u32
Returns a numeric error code for embedded environments
Sourcepub const fn error_category(&self) -> u32
pub const fn error_category(&self) -> u32
Returns the error category (high nibble)
Sourcepub fn with_context<S: Into<String>>(self, context: S) -> Self
pub fn with_context<S: Into<String>>(self, context: S) -> Self
Adds additional context to an error (std only)
Sourcepub fn into_anyhow(self) -> Error
pub fn into_anyhow(self) -> Error
Converts this error into an anyhow::Error (std only)
Trait Implementations§
Source§impl Error for DbError
impl Error for DbError
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()
Source§impl From<DbError> for RemoteError
impl From<DbError> for RemoteError
Source§impl From<ExecutorError> for DbError
Convert executor errors to database errors
impl From<ExecutorError> for DbError
Convert executor errors to database errors
This allows runtime adapters to return ExecutorError while the core
database works with DbError for consistency across the API.