[pbs-devel] [RFC proxmox v2 3/4] rest-server: make worker task creation error handling more idiomatic

Fabian Grünbichler f.gruenbichler at proxmox.com
Mon Dec 2 14:04:11 CET 2024


Signed-off-by: Fabian Grünbichler <f.gruenbichler at proxmox.com>
---

Notes:
    best I could come up with ;) feel free to fold that one in

 proxmox-rest-server/src/worker_task.rs | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/proxmox-rest-server/src/worker_task.rs b/proxmox-rest-server/src/worker_task.rs
index bbf82ff9..74828855 100644
--- a/proxmox-rest-server/src/worker_task.rs
+++ b/proxmox-rest-server/src/worker_task.rs
@@ -928,10 +928,10 @@ impl WorkerTask {
         if res.is_err() {
             // needed to undo the insertion into WORKER_TASK_LIST above
             worker.log_result(&res);
-            res?
+            Err(res.unwrap_err())
+        } else {
+            Ok((worker, logger))
         }
-
-        Ok((worker, logger))
     }
 
     /// Spawn a new tokio task/future.
-- 
2.39.5





More information about the pbs-devel mailing list