From a6bd5d91f2704d7bb4234818948fe802989c2ca3 Mon Sep 17 00:00:00 2001
From: Jens Steidl <Jens.Steidl@slub-dresden.de>
Date: Mon, 12 Oct 2020 11:42:22 +0200
Subject: [PATCH] - skip if no error

---
 bin/slubsipbuilderbagit.pl | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)

diff --git a/bin/slubsipbuilderbagit.pl b/bin/slubsipbuilderbagit.pl
index e554f76..3e93a33 100644
--- a/bin/slubsipbuilderbagit.pl
+++ b/bin/slubsipbuilderbagit.pl
@@ -91,13 +91,15 @@ MODS
         eval {
             $mods = SLUB::LZA::SIPBuilderBagIt::get_mods_from($swb_url, $ppn, $searchkey_swb, $recordschema);
         };
-        # Fallback to K10plus PPN
-        if ($@ =~ m#ERROR: Did not get any <recordData/> for PPN#) {
-            print_scalar_data("", "WARNING: '$ppn' not a SWB PPN, fallback to K10plus", "", "yellow");
-            $mods = SLUB::LZA::SIPBuilderBagIt::get_mods_from($swb_url, $ppn, $searchkey_k10p, $recordschema);
-        }
-        else {
-            die $@; # throw exception again
+        if ($@) {
+            # Fallback to K10plus PPN
+            if ($@ =~ m#ERROR: Did not get any <recordData/> for PPN#) {
+                print_scalar_data("", "WARNING: '$ppn' not a SWB PPN, fallback to K10plus", "", "yellow");
+                $mods = SLUB::LZA::SIPBuilderBagIt::get_mods_from($swb_url, $ppn, $searchkey_k10p, $recordschema);
+            }
+            else {
+                die "$@"; # throw exception again
+            }
         }
         print_scalar_data("", "INFO: Found metadata for PPN '$ppn'", "", "white");
 
-- 
GitLab