mirror of
https://github.com/rustfs/rustfs.git
synced 2026-08-09 14:49:25 +00:00
fix quorum err
This commit is contained in:
@@ -1,5 +1,9 @@
|
||||
use std::io;
|
||||
|
||||
use tracing_error::{SpanTrace, SpanTraceStatus};
|
||||
|
||||
use crate::disk::error::{clone_disk_err, DiskError};
|
||||
|
||||
pub type StdError = Box<dyn std::error::Error + Send + Sync + 'static>;
|
||||
|
||||
pub type Result<T = (), E = Error> = std::result::Result<T, E>;
|
||||
@@ -80,3 +84,16 @@ impl std::fmt::Display for Error {
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
impl Clone for Error {
|
||||
fn clone(&self) -> Self {
|
||||
if let Some(e) = self.downcast_ref::<DiskError>() {
|
||||
clone_disk_err(e)
|
||||
} else if let Some(e) = self.downcast_ref::<io::Error>() {
|
||||
Error::new(io::Error::new(e.kind(), e.to_string()))
|
||||
} else {
|
||||
// TODO: 优化其他类型
|
||||
Error::msg(self.to_string())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user