src/api_schema/schema.rs: improve ParameterError display function
This commit is contained in:
parent
f661f37427
commit
92a173feb0
@ -36,9 +36,16 @@ impl ParameterError {
|
||||
|
||||
impl fmt::Display for ParameterError {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
let msg = self.error_list.iter().fold(String::from(""), |acc, item| {
|
||||
|
||||
let mut msg = String::new();
|
||||
|
||||
if self.len() > 0 {
|
||||
msg.push_str("parameter verification errors\n\n");
|
||||
}
|
||||
|
||||
msg.push_str(&self.error_list.iter().fold(String::from(""), |acc, item| {
|
||||
acc + &item.to_string() + "\n"
|
||||
});
|
||||
}));
|
||||
|
||||
write!(f, "{}", msg)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user