[pbs-devel] [PATCH proxmox] schema: removed excessive newlines in error messages

Gabriel Goller g.goller at proxmox.com
Fri Sep 1 10:12:59 CEST 2023


The output does not look good on console/task view when there is an
empty line after the first error and trailing newlines after
the last error. Removed the newlines.

Example:
before:
```
$ proxmox-backup-client ...
Error: parameter verification errors

parameter 'file-name': value does not match the regex pattern

$
```
now:
```
$ proxmox-backup-client ...
Error: parameter verification errors
parameter 'file-name': value does not match the regex pattern
$
```

Signed-off-by: Gabriel Goller <g.goller at proxmox.com>
---
 proxmox-schema/src/schema.rs | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/proxmox-schema/src/schema.rs b/proxmox-schema/src/schema.rs
index f087706..596adee 100644
--- a/proxmox-schema/src/schema.rs
+++ b/proxmox-schema/src/schema.rs
@@ -101,14 +101,14 @@ impl fmt::Display for ParameterError {
         let mut msg = String::new();
 
         if !self.is_empty() {
-            msg.push_str("parameter verification errors\n\n");
+            msg.push_str("parameter verification errors\n");
         }
 
         for (name, err) in self.error_list.iter() {
             let _ = writeln!(msg, "parameter '{}': {}", name, err);
         }
 
-        write!(f, "{}", msg)
+        write!(f, "{}", msg.trim())
     }
 }
 
-- 
2.39.2






More information about the pbs-devel mailing list