pub enum Error {
Io(Error),
Storage(String),
Validation(String),
Hash(String),
Serialization(String),
HexDecode(FromHexError),
Json(Error),
Time(String),
NotFound(String),
AlreadyExists(String),
InvalidFormat(String),
Unsupported(String),
}Expand description
Main error type for Atlas Core operations
This enum represents all possible errors that can occur in the Atlas Core library.
It uses the thiserror crate for automatic Error trait implementation.
Variants§
Io(Error)
I/O operation error
Storage(String)
Storage backend error
Validation(String)
Validation error for invalid data or formats
Hash(String)
Hash operation or verification error
Serialization(String)
Serialization/deserialization error
HexDecode(FromHexError)
Hex decoding error (only with hash feature)
Json(Error)
JSON processing error
Time(String)
Time/datetime related error
NotFound(String)
Resource not found error
AlreadyExists(String)
Resource already exists error
InvalidFormat(String)
Invalid format error
Unsupported(String)
Unsupported operation error
Implementations§
Source§impl Error
impl Error
Sourcepub fn is_retriable(&self) -> bool
pub fn is_retriable(&self) -> bool
Check if the error is retriable
Returns true for transient errors that might succeed on retry,
such as I/O or storage errors.
§Example
use atlas_common::Error;
let error = Error::Io(std::io::Error::new(
std::io::ErrorKind::TimedOut,
"timeout"
));
assert!(error.is_retriable());Sourcepub fn error_code(&self) -> &'static str
pub fn error_code(&self) -> &'static str
Get a stable error code for API responses
Returns a constant string identifier for each error variant, useful for API error responses.
§Example
use atlas_common::Error;
let error = Error::NotFound("manifest".to_string());
assert_eq!(error.error_code(), "NOT_FOUND");Trait Implementations§
Source§impl Error for Error
impl Error for Error
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
Source§impl From<FromHexError> for Error
impl From<FromHexError> for Error
Source§fn from(source: FromHexError) -> Self
fn from(source: FromHexError) -> Self
Auto Trait Implementations§
impl Freeze for Error
impl !RefUnwindSafe for Error
impl Send for Error
impl Sync for Error
impl Unpin for Error
impl !UnwindSafe for Error
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
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>
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>
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