Skip to main content

DbError

Enum DbError 

Source
#[non_exhaustive]
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, }, BufferEmpty, RecordNotFound { record_name: String, }, RecordKeyNotFound { key: String, }, InvalidRecordId { id: u32, }, TypeMismatch { record_id: u32, expected_type: String, }, InvalidOperation { operation: String, reason: String, }, PermissionDenied { operation: String, }, MissingConfiguration { parameter: String, }, InvalidConfiguration { errors: Vec<ConfigError>, }, RuntimeError { message: String, }, Internal { code: u32, message: String, }, 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.

#[non_exhaustive]: match on DbError::kind where you only need to know what to do about the failure.

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

ConnectionFailed

Connection or timeout failures

Fields

§endpoint: String
§reason: String
§

BufferFull

Buffer is full and cannot accept more items

Fields

§size: u32
§buffer_name: String
§

BufferLagged

Consumer lagged behind producer (SPMC ring buffers)

Fields

§lag_count: u64
§buffer_name: String
§

BufferClosed

Buffer channel has been closed (shutdown)

Fields

§buffer_name: String
§

BufferEmpty

Non-blocking receive found no pending values

§

RecordNotFound

Record type not found in database (legacy, by type name)

Fields

§record_name: String
§

RecordKeyNotFound

Record key not found in registry

Fields

§

InvalidRecordId

RecordId out of bounds or invalid

Fields

§id: u32
§

TypeMismatch

Type mismatch when accessing record by ID

Fields

§record_id: u32
§expected_type: String
§

InvalidOperation

Invalid operation attempted

Fields

§operation: String
§reason: String
§

PermissionDenied

Permission denied for operation

Fields

§operation: String
§

MissingConfiguration

Missing required configuration parameter

Fields

§parameter: String
§

InvalidConfiguration

Configuration mistakes collected by AimDbBuilder::build() — one entry per finding, so a single run surfaces every mistake.

Fields

§

RuntimeError

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

Fields

§message: String
§

Internal

Internal error for unexpected conditions

Fields

§code: u32
§message: String
§

CyclicDependency

Transform dependency graph contains a cycle

Fields

§records: Vec<String>
§

TransformInputNotFound

Transform input key references a record that was not registered

Fields

§output_key: String
§input_key: String
§

Io

I/O operation error

Fields

§source: Error
§

IoWithContext

I/O operation error with context

Fields

§context: String
§source: Error
§

Json

JSON serialization error

Fields

§source: Error
§

JsonWithContext

JSON serialization error with context

Fields

§context: String
§source: Error

Implementations§

Source§

impl DbError

Source

pub fn runtime_error(message: impl Into<String>) -> Self

Builds a RuntimeError.

Source

pub fn permission_denied(operation: impl Into<String>) -> Self

Builds a PermissionDenied.

Source

pub fn record_key_not_found(key: impl Into<String>) -> Self

Source

pub fn missing_configuration(parameter: impl Into<String>) -> Self

Source§

impl DbError

Source

pub fn kind(&self) -> DbErrorKind

Classify the failure by what the caller can do about it.

Exhaustive inside the crate that owns the enum: a variant added later fails to compile here instead of falling into a downstream wildcard.

Trait Implementations§

Source§

impl Debug for DbError

Source§

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

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

impl Display for DbError

Source§

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

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<DbError> for RemoteError

Source§

fn from(err: DbError) -> Self

Converts to this type from the input type.
Source§

impl From<Error> for DbError

Source§

fn from(source: Error) -> Self

Converts to this type from the input type.
Source§

impl From<Error> for DbError

Source§

fn from(source: Error) -> Self

Converts to this type from the input type.
Source§

impl From<ExecutorError> for DbError

Convert executor errors to database errors

This allows engine plumbing to return ExecutorError while the core database works with DbError for consistency across the API.

Source§

fn from(err: ExecutorError) -> Self

Converts to this type from the input type.

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, 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 = !

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

fn try_from(value: U) -> Result<T, !>

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.