pub struct ErrorUtils;Expand description
Utility functions for common error handling patterns in database operations
Implementations§
Source§impl ErrorUtils
impl ErrorUtils
Sourcepub fn serialization_error(context: &str, error: Error) -> SchemaError
pub fn serialization_error(context: &str, error: Error) -> SchemaError
Creates a serialization error with consistent formatting
Sourcepub fn deserialization_error(context: &str, error: Error) -> SchemaError
pub fn deserialization_error(context: &str, error: Error) -> SchemaError
Creates a deserialization error with consistent formatting
Sourcepub fn database_error(operation: &str, error: Error) -> SchemaError
pub fn database_error(operation: &str, error: Error) -> SchemaError
Creates a database operation error with consistent formatting
Sourcepub fn tree_error(operation: &str, tree_name: &str, error: Error) -> SchemaError
pub fn tree_error(operation: &str, tree_name: &str, error: Error) -> SchemaError
Creates a tree operation error with consistent formatting
Sourcepub fn lock_error(resource: &str) -> SchemaError
pub fn lock_error(resource: &str) -> SchemaError
Creates a lock acquisition error with consistent formatting
Sourcepub fn not_found_error(resource_type: &str, identifier: &str) -> SchemaError
pub fn not_found_error(resource_type: &str, identifier: &str) -> SchemaError
Creates a not found error with consistent formatting
Sourcepub fn invalid_data_error(context: &str, details: &str) -> SchemaError
pub fn invalid_data_error(context: &str, details: &str) -> SchemaError
Creates an invalid data error with consistent formatting
Sourcepub fn from_sled_error(operation: &str) -> impl Fn(Error) -> SchemaError + '_
pub fn from_sled_error(operation: &str) -> impl Fn(Error) -> SchemaError + '_
Helper for converting sled errors in database operations
Sourcepub fn from_serialization_error(
context: &str,
) -> impl Fn(Error) -> SchemaError + '_
pub fn from_serialization_error( context: &str, ) -> impl Fn(Error) -> SchemaError + '_
Helper for converting serialization errors
Sourcepub fn from_deserialization_error(
context: &str,
) -> impl Fn(Error) -> SchemaError + '_
pub fn from_deserialization_error( context: &str, ) -> impl Fn(Error) -> SchemaError + '_
Helper for converting deserialization errors
Auto Trait Implementations§
impl Freeze for ErrorUtils
impl RefUnwindSafe for ErrorUtils
impl Send for ErrorUtils
impl Sync for ErrorUtils
impl Unpin for ErrorUtils
impl UnwindSafe for ErrorUtils
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreCreates a shared type from an unshared type.