[pbs-devel] [PATCH v7 proxmox 1/10] worker task: include anyhow error context in state error message
    Christian Ebner 
    c.ebner at proxmox.com
       
    Thu Mar 20 14:17:02 CET 2025
    
    
  
Currently the anyhow error context of a given error is not included
in the error message, as `to_string` does use the default formatting
[0].
Include the error context, formatting it as single line as the
message is also shown to the users in e.g. the Proxmox Backup Severs
task state in the UI.
[0] https://docs.rs/anyhow/latest/anyhow/struct.Error.html#display-representations
Signed-off-by: Christian Ebner <c.ebner at proxmox.com>
---
changes since version 6:
- not present in previous version
 proxmox-rest-server/src/worker_task.rs | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/proxmox-rest-server/src/worker_task.rs b/proxmox-rest-server/src/worker_task.rs
index 2968a68c..a3a65add 100644
--- a/proxmox-rest-server/src/worker_task.rs
+++ b/proxmox-rest-server/src/worker_task.rs
@@ -1003,7 +1003,7 @@ impl WorkerTask {
 
         if let Err(err) = result {
             TaskState::Error {
-                message: err.to_string(),
+                message: format!("{err:#}"),
                 endtime,
             }
         } else if warn_count > 0 {
-- 
2.39.5
    
    
More information about the pbs-devel
mailing list