mirror of
https://github.com/rustfs/rustfs.git
synced 2026-08-22 12:26:37 +00:00
refactor(deps): replace snafu and heal anyhow (#4266)
This commit is contained in:
@@ -40,9 +40,6 @@ pub enum Error {
|
||||
#[error("Other error: {0}")]
|
||||
Other(String),
|
||||
|
||||
#[error(transparent)]
|
||||
Anyhow(#[from] anyhow::Error),
|
||||
|
||||
#[error("Serialization error: {0}")]
|
||||
Serialization(String),
|
||||
|
||||
@@ -94,11 +91,8 @@ pub type Result<T, E = Error> = std::result::Result<T, E>;
|
||||
|
||||
impl Error {
|
||||
/// Create an Other error from any error type
|
||||
pub fn other<E>(error: E) -> Self
|
||||
where
|
||||
E: Into<Box<dyn std::error::Error + Send + Sync>>,
|
||||
{
|
||||
Error::Other(error.into().to_string())
|
||||
pub fn other(error: impl std::fmt::Display) -> Self {
|
||||
Error::Other(error.to_string())
|
||||
}
|
||||
|
||||
/// Create a transient skip error for retryable background heal checks.
|
||||
|
||||
@@ -588,7 +588,7 @@ fn is_recoverable_heal_error(err: &Error, error: &str) -> bool {
|
||||
Error::TaskTimeout | Error::TransientSkip { .. } => true,
|
||||
Error::Storage(err) => is_recoverable_storage_heal_error(err) || is_recoverable_heal_error_message(error),
|
||||
Error::Disk(err) => is_recoverable_disk_heal_error(err) || is_recoverable_heal_error_message(error),
|
||||
Error::TaskExecutionFailed { .. } | Error::Io(_) | Error::IO(_) | Error::Anyhow(_) | Error::Other(_) => {
|
||||
Error::TaskExecutionFailed { .. } | Error::Io(_) | Error::IO(_) | Error::Other(_) => {
|
||||
is_recoverable_heal_error_message(error)
|
||||
}
|
||||
_ => false,
|
||||
|
||||
Reference in New Issue
Block a user