]> git.proxmox.com Git - pve-cluster.git/commitdiff
cfs_lock: re-raise exceptions
authorFabian Grünbichler <f.gruenbichler@proxmox.com>
Wed, 29 Apr 2020 08:52:51 +0000 (10:52 +0200)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Wed, 29 Apr 2020 09:10:49 +0000 (11:10 +0200)
so that API paths that raise an exception while holding a CFS lock
properly propagate that exception to the client, instead of the
stringified version with added noise about locks added to the front.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
data/PVE/Cluster.pm

index b4de9895a05fe549419b49fbae675d51e9681320..cce681b515131007e8c172e13f9dc2c8f6f45475 100644 (file)
@@ -609,7 +609,13 @@ my $cfs_lock = sub {
     alarm($prev_alarm);
 
     if ($err) {
-        $@ = "error with cfs lock '$lockid': $err";
+       if (ref($err) eq 'PVE::Exception') {
+           # re-raise defined exceptions
+           $@ = $err;
+       } else {
+           # add lock info for plain errors 
+           $@ = "error with cfs lock '$lockid': $err";
+       }
         return undef;
     }