diff --git a/bin/slubsipbuilderbagit.pl b/bin/slubsipbuilderbagit.pl index e554f76729ce60a8aa8c7cb1dd68feb611426103..3e93a333fffa08d20a7f4fe5a183b47e405b6d2d 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");