feat: cleanup aggregate error for single error
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
2
Cargo.lock
generated
2
Cargo.lock
generated
@@ -278,7 +278,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "notmad"
|
||||
version = "0.7.2"
|
||||
version = "0.7.3"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"async-trait",
|
||||
|
@@ -49,6 +49,14 @@ impl AggregateError {
|
||||
|
||||
impl Display for AggregateError {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
if self.errors.is_empty() {
|
||||
return Ok(());
|
||||
}
|
||||
|
||||
if self.errors.len() == 1 {
|
||||
return f.write_str(&self.errors.first().unwrap().to_string());
|
||||
}
|
||||
|
||||
f.write_str("MadError::AggregateError: (")?;
|
||||
|
||||
for error in &self.errors {
|
||||
|
Reference in New Issue
Block a user