]> Dogcows Code - chaz/p5-File-KDBX/commitdiff
Fix error wrapping
authorCharles McGarvey <ccm@cpan.org>
Tue, 19 Apr 2022 00:29:38 +0000 (18:29 -0600)
committerCharles McGarvey <ccm@cpan.org>
Sun, 1 May 2022 00:29:00 +0000 (18:29 -0600)
lib/File/KDBX/Error.pm

index f80155796f4ae40e8d17afcda9dd8b0c8bdfce39..6ea064970b850d4f893abbe8cf540b55e1fb518c 100644 (file)
@@ -78,10 +78,11 @@ as a B<File::KDBX::Error>. Example:
 =cut
 
 sub error {
+    my $class = @_ && $_[0] eq __PACKAGE__ ? shift : undef;
     my $self = (blessed($_[0]) && $_[0]->isa('File::KDBX::Error'))
         ? shift
-        : (@_ && $_[0] eq __PACKAGE__)
-            ? shift->new(@_)
+        : $class
+            ? $class->new(@_)
             : __PACKAGE__->new(@_);
     return $self;
 }
This page took 0.022422 seconds and 4 git commands to generate.