From e6a8bc32b52a9137959f6701471fab7e71de1466 Mon Sep 17 00:00:00 2001
From: bolkun <bolkun@BDV092.slub-dresden.de>
Date: Thu, 29 Apr 2021 13:56:36 +0200
Subject: [PATCH] Replaced croak with color error print and die function

---
 bin/slubsipbuilderbagit.pl | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/bin/slubsipbuilderbagit.pl b/bin/slubsipbuilderbagit.pl
index db71bc4..b56c702 100644
--- a/bin/slubsipbuilderbagit.pl
+++ b/bin/slubsipbuilderbagit.pl
@@ -205,7 +205,10 @@ package SLUB::LZA::SIPBuilderBagIt;
                 SLUB::LZA::SIPBuilderBagIt::write_file("DEBUG_${ppn}_catalog_response.xml", $response->decoded_content);
             }
             my $recordData = $xp->findnodes_as_string('/*[local-name()="searchRetrieveResponse"]/*[local-name()="records"]/*[local-name()="record"]/*[local-name()="recordData"]/*');
-            if (!$recordData) { croak("ERROR: Did not get any <recordData/> for PPN '$ppn' using '$sru'");}
+            if (!$recordData) {
+                print_scalar_data("", "ERROR: did not get any <recordData/> for PPN '$ppn' using '$sru'", "", "red");
+                die();
+            }
             my $marc_doc = $parser->parse_string($recordData);
             add_marc21_schema_location($marc_doc);
             if ($with_debug) {
-- 
GitLab