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]]
|
[[package]]
|
||||||
name = "notmad"
|
name = "notmad"
|
||||||
version = "0.7.2"
|
version = "0.7.3"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"async-trait",
|
"async-trait",
|
||||||
|
@@ -49,6 +49,14 @@ impl AggregateError {
|
|||||||
|
|
||||||
impl Display for AggregateError {
|
impl Display for AggregateError {
|
||||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
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: (")?;
|
f.write_str("MadError::AggregateError: (")?;
|
||||||
|
|
||||||
for error in &self.errors {
|
for error in &self.errors {
|
||||||
|
Reference in New Issue
Block a user