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");