Skip to content
Snippets Groups Projects
Commit 1941613f authored by Jens Steidl's avatar Jens Steidl :baby_chick:
Browse files

- improved user infos regarding catalogue search: colored text instead of croak (on fallback)

- added original errors to debug
- added comments
parent e7bf4134
No related branches found
No related tags found
No related merge requests found
......@@ -132,21 +132,39 @@ package SLUB::LZA::SIPBuilderBagIt;
my $ppn = shift;
my $marc21;
eval {
my $use_fallback;
eval { # try SWB
$marc21 = SLUB::LZA::SIPBuilderBagIt::get_marc21_from($swb_url, $ppn, $searchkey_swb, $recordschema_swb);
};
if ($@) {
# Fallback to K10plus PPN
if ($@) { # error
say "$@" unless (! $with_debug);
if ($@ =~ m#ERROR: Did not get any <recordData/> for PPN#) {
print_scalar_data("", "WARNING: '$ppn' not a SWB PPN, fallback to K10plus", "", "yellow");
$marc21 = SLUB::LZA::SIPBuilderBagIt::get_marc21_from($swb_url, $ppn, $searchkey_k10p, $recordschema_k10p);
$use_fallback = 1;
}
else {
die "$@"; # throw exception again
}
}
print_scalar_data("", "INFO: Found metadata for PPN '$ppn'", "", "white");
if ($use_fallback) {
eval { # try K10plus
$marc21 = SLUB::LZA::SIPBuilderBagIt::get_marc21_from($swb_url, $ppn, $searchkey_k10p, $recordschema_k10p);
};
if ($@) { # error
say "$@" unless (!$with_debug);
if ($@ =~ m#ERROR: Did not get any <recordData/> for PPN#) {
print_scalar_data("", "ERROR: '$ppn' also not a K10plus PPN", "", "red");
exit 1;
}
else {
die "$@"; # throw exception again
}
}
}
print_scalar_data("", "INFO: Found metadata for PPN '$ppn'", "", "white");
return $marc21;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment