refactor(deps): replace snafu and heal anyhow (#4266)

This commit is contained in:
houseme
2026-07-05 00:31:37 +08:00
committed by GitHub
parent 86eafc799b
commit 6dabbaab4d
10 changed files with 32 additions and 68 deletions
+2 -8
View File
@@ -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.
+1 -1
View File
@@ -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,