DbError

Enum DbError 

Source
pub enum DbError {
Show 21 variants ConnectionFailed { endpoint: String, reason: String, }, BufferFull { size: u32, buffer_name: String, }, BufferLagged { lag_count: u64, buffer_name: String, }, BufferClosed { buffer_name: String, }, RecordNotFound { record_name: 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, 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

Fields

§endpoint: String
Available on crate feature std only.
§reason: String
Available on crate feature std only.
§

BufferFull

Buffer is full and cannot accept more items

Fields

§size: u32
§buffer_name: String
Available on crate feature std only.
§

BufferLagged

Consumer lagged behind producer (SPMC ring buffers)

Fields

§lag_count: u64
§buffer_name: String
Available on crate feature std only.
§

BufferClosed

Buffer channel has been closed (shutdown)

Fields

§buffer_name: String
Available on crate feature std only.
§

RecordNotFound

Record type not found in database

Fields

§record_name: String
Available on crate feature std only.
§

InvalidOperation

Invalid operation attempted

Fields

§operation: String
Available on crate feature std only.
§reason: String
Available on crate feature std only.
§

PermissionDenied

Permission denied for operation

Fields

§operation: String
Available on crate feature std only.
§

MissingConfiguration

Missing required configuration parameter

Fields

§parameter: String
Available on crate feature std only.
§

RuntimeError

Runtime execution error (task spawning, scheduling, etc.)

Fields

§message: String
Available on crate feature std only.
§

ResourceUnavailable

Resource temporarily unavailable (used by adapters)

Fields

§resource_type: u8
§resource_name: String
Available on crate feature std only.
§

HardwareError

Hardware-specific errors for embedded/MCU environments

Fields

§component: u8
§error_code: u16
§description: String
Available on crate feature std only.
§

Internal

Internal error for unexpected conditions

Fields

§code: u32
§message: String
Available on crate feature std only.
§

AttachFailed

Available on crate feature std only.

Failed to attach database to runtime thread

Fields

§message: String
§

DetachFailed

Available on crate feature std only.

Failed to detach database from runtime thread

Fields

§message: String
§

SetTimeout

Available on crate feature std only.

Timeout while setting a value

§

GetTimeout

Available on crate feature std only.

Timeout while getting a value

§

RuntimeShutdown

Available on crate feature std only.

Runtime thread has shut down

§

Io

Available on crate feature std only.

I/O operation error

Fields

§source: Error
§

IoWithContext

Available on crate feature std only.

I/O operation error with context

Fields

§context: String
§source: Error
§

Json

Available on crate feature std only.

JSON serialization error

Fields

§source: Error
§

JsonWithContext

Available on crate feature std only.

JSON serialization error with context

Fields

§context: String
§source: Error

Implementations§

Source§

impl DbError

Source

pub const RESOURCE_TYPE_MEMORY: u8 = 0u8

Source

pub const RESOURCE_TYPE_FILE_HANDLE: u8 = 1u8

Source

pub const RESOURCE_TYPE_SOCKET: u8 = 2u8

Source

pub const RESOURCE_TYPE_BUFFER: u8 = 3u8

Source

pub const RESOURCE_TYPE_THREAD: u8 = 4u8

Source

pub const RESOURCE_TYPE_MUTEX: u8 = 5u8

Source

pub const RESOURCE_TYPE_SEMAPHORE: u8 = 6u8

Source

pub const RESOURCE_TYPE_CHANNEL: u8 = 7u8

Source

pub const RESOURCE_TYPE_WOULD_BLOCK: u8 = 255u8

Source

pub fn hardware_error(component: u8, error_code: u16) -> DbError

Creates a hardware error for embedded environments

Source

pub fn internal(code: u32) -> DbError

Creates an internal error with a specific error code

Source

pub fn is_network_error(&self) -> bool

Returns true if this is a network-related error

Source

pub fn is_capacity_error(&self) -> bool

Returns true if this is a capacity-related error

Source

pub fn is_hardware_error(&self) -> bool

Returns true if this is a hardware-related error

Source

pub const fn error_code(&self) -> u32

Returns a numeric error code for embedded environments

Source

pub const fn error_category(&self) -> u32

Returns the error category (high nibble)

Source

pub fn with_context<S>(self, context: S) -> DbError
where S: Into<String>,

Available on crate feature std only.

Adds additional context to an error (std only)

Source

pub fn into_anyhow(self) -> Error

Available on crate feature std only.

Converts this error into an anyhow::Error (std only)

Trait Implementations§

Source§

impl Debug for DbError

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl Display for DbError

Source§

fn fmt(&self, __formatter: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl Error for DbError

Source§

fn source(&self) -> Option<&(dyn Error + 'static)>

Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§

fn description(&self) -> &str

👎Deprecated since 1.42.0: use the Display impl or to_string()
1.0.0 · Source§

fn cause(&self) -> Option<&dyn Error>

👎Deprecated since 1.33.0: replaced by Error::source, which can support downcasting
Source§

fn provide<'a>(&'a self, request: &mut Request<'a>)

🔬This is a nightly-only experimental API. (error_generic_member_access)
Provides type-based access to context intended for error reports. Read more
Source§

impl From<Error> for DbError

Source§

fn from(source: Error) -> DbError

Converts to this type from the input type.
Source§

impl From<Error> for DbError

Source§

fn from(source: Error) -> DbError

Converts to this type from the input type.
Source§

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.

Source§

fn from(err: ExecutorError) -> DbError

Converts to this type from the input type.
Source§

impl TokioErrorSupport for DbError

Source§

fn from_join_error(error: JoinError) -> DbError

Converts a tokio::task::JoinError to DbError.

This is the only production-critical error conversion for the Tokio adapter. Task join errors occur when spawned tasks fail, and require special handling to distinguish between cancellation, panics, and regular task failures.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more