pub enum Error {
Show 18 variants
Io(Error),
Corruption(String),
NotFound(String),
InvalidArgument(String),
AlreadyExists(String),
WalFull,
ChecksumMismatch,
Internal(String),
EncryptionError(String),
CompressionError(String),
ManifestCorruption(String),
CompactionError(String),
StripeError(String),
InvalidExpression(String),
ConditionalCheckFailed(String),
TransactionCanceled(String),
InvalidQuery(String),
ResourceExhausted(String),
}Variants§
Io(Error)
Corruption(String)
NotFound(String)
InvalidArgument(String)
AlreadyExists(String)
WalFull
ChecksumMismatch
Internal(String)
EncryptionError(String)
CompressionError(String)
ManifestCorruption(String)
CompactionError(String)
StripeError(String)
InvalidExpression(String)
ConditionalCheckFailed(String)
TransactionCanceled(String)
InvalidQuery(String)
ResourceExhausted(String)
Implementations§
Source§impl Error
impl Error
Sourcepub fn code(&self) -> &'static str
pub fn code(&self) -> &'static str
Returns a stable error code for this error variant. These codes are stable and can be used by clients for error classification.
Sourcepub fn is_retryable(&self) -> bool
pub fn is_retryable(&self) -> bool
Returns true if this error is potentially retryable.
Transient errors like IO errors are retryable, while logical errors like InvalidArgument or ConditionalCheckFailed are not.
Sourcepub fn with_context(self, context: &str) -> Error
pub fn with_context(self, context: &str) -> Error
Adds context to an error by wrapping it in an Internal error.
This is useful for adding operation context to errors that propagate from lower layers.
§Examples
use kstone_core::Error;
fn write_data() -> Result<(), Error> {
// Some operation that might fail
Err(Error::Io(std::io::Error::new(
std::io::ErrorKind::NotFound,
"file not found"
)))
}
fn save_record() -> Result<(), Error> {
write_data().map_err(|e| e.with_context("failed to save record"))
}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)>
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()
Auto Trait Implementations§
impl Freeze for Error
impl !RefUnwindSafe for Error
impl Send for Error
impl Sync for Error
impl Unpin for Error
impl UnsafeUnpin 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
Mutably borrows from an owned value. Read more