pub struct NitriteError { /* private fields */ }Expand description
Custom Nitrite error type.
NitriteError encapsulates error information including the error message, kind, and optional cause.
It supports error chaining and backtraces for debugging.
§Examples
ⓘ
use nitrite::errors::{NitriteError, ErrorKind};
// Create a simple error
let err = NitriteError::new("Index not found", ErrorKind::IndexNotFound);
// Create an error with a cause
let cause = NitriteError::new("IO failed", ErrorKind::IOError);
let err = NitriteError::new_with_cause("Index build failed", ErrorKind::IndexBuildFailed, cause);§Type alias
The NitriteResult<T> type alias is equivalent to Result<T, NitriteError> and is used
throughout the codebase for operations that can fail.
Implementations§
Source§impl NitriteError
impl NitriteError
Sourcepub fn new_with_cause(
message: &str,
error_type: ErrorKind,
cause: NitriteError,
) -> Self
pub fn new_with_cause( message: &str, error_type: ErrorKind, cause: NitriteError, ) -> Self
Creates a new NitriteError with a cause error.
This creates an error chain where the cause error is preserved for debugging.
§Arguments
message- A description of the errorerror_type- The category of errorcause- The underlying error that caused this error
§Returns
A new NitriteError instance with the cause error attached.
pub fn message(&self) -> &str
pub fn kind(&self) -> &ErrorKind
pub fn cause(&self) -> Option<&NitriteError>
Trait Implementations§
Source§impl Clone for NitriteError
impl Clone for NitriteError
Source§fn clone(&self) -> NitriteError
fn clone(&self) -> NitriteError
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for NitriteError
impl Debug for NitriteError
Source§impl Display for NitriteError
impl Display for NitriteError
Source§impl Error for NitriteError
impl Error for NitriteError
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
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
fn description(&self) -> &str
👎Deprecated since 1.42.0:
use the Display impl or to_string()
Source§impl Error for NitriteError
impl Error for NitriteError
Source§fn custom<T: Display>(msg: T) -> Self
fn custom<T: Display>(msg: T) -> Self
Raised when there is general error when deserializing a type. Read more
Source§fn invalid_type(unexp: Unexpected<'_>, exp: &dyn Expected) -> Self
fn invalid_type(unexp: Unexpected<'_>, exp: &dyn Expected) -> Self
Raised when a
Deserialize receives a type different from what it was
expecting. Read moreSource§fn invalid_value(unexp: Unexpected<'_>, exp: &dyn Expected) -> Self
fn invalid_value(unexp: Unexpected<'_>, exp: &dyn Expected) -> Self
Raised when a
Deserialize receives a value of the right type but that
is wrong for some other reason. Read moreSource§fn invalid_length(len: usize, exp: &dyn Expected) -> Self
fn invalid_length(len: usize, exp: &dyn Expected) -> Self
Raised when deserializing a sequence or map and the input data contains
too many or too few elements. Read more
Source§fn unknown_variant(variant: &str, expected: &'static [&'static str]) -> Self
fn unknown_variant(variant: &str, expected: &'static [&'static str]) -> Self
Raised when a
Deserialize enum type received a variant with an
unrecognized name.Source§fn unknown_field(field: &str, expected: &'static [&'static str]) -> Self
fn unknown_field(field: &str, expected: &'static [&'static str]) -> Self
Raised when a
Deserialize struct type received a field with an
unrecognized name.Source§fn missing_field(field: &'static str) -> Self
fn missing_field(field: &'static str) -> Self
Raised when a
Deserialize struct type expected to receive a required
field with a particular name but that field was not present in the
input.Source§fn duplicate_field(field: &'static str) -> Self
fn duplicate_field(field: &'static str) -> Self
Raised when a
Deserialize struct type received more than one of the
same field.Source§impl Error for NitriteError
impl Error for NitriteError
Source§impl From<&str> for NitriteError
impl From<&str> for NitriteError
Source§impl From<Error> for NitriteError
impl From<Error> for NitriteError
Source§impl From<Error> for NitriteError
impl From<Error> for NitriteError
Source§impl From<FromUtf8Error> for NitriteError
impl From<FromUtf8Error> for NitriteError
Source§fn from(err: FromUtf8Error) -> Self
fn from(err: FromUtf8Error) -> Self
Converts to this type from the input type.
Source§impl From<ParseFloatError> for NitriteError
impl From<ParseFloatError> for NitriteError
Source§fn from(err: ParseFloatError) -> Self
fn from(err: ParseFloatError) -> Self
Converts to this type from the input type.
Source§impl From<ParseIntError> for NitriteError
impl From<ParseIntError> for NitriteError
Source§fn from(err: ParseIntError) -> Self
fn from(err: ParseIntError) -> Self
Converts to this type from the input type.
Auto Trait Implementations§
impl !RefUnwindSafe for NitriteError
impl !UnwindSafe for NitriteError
impl Freeze for NitriteError
impl Send for NitriteError
impl Sync for NitriteError
impl Unpin for NitriteError
impl UnsafeUnpin for NitriteError
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> ErasedDestructor for Twhere
T: 'static,
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 more