From e7bf413432f8e1228b2cb1ecc47db468eb02965d Mon Sep 17 00:00:00 2001
From: Jens Steidl <Jens.Steidl@slub-dresden.de>
Date: Tue, 16 Mar 2021 12:28:22 +0100
Subject: [PATCH] - improved user infos: colored text instead of croak

---
 bin/slubsipbuilderbagit.pl | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/bin/slubsipbuilderbagit.pl b/bin/slubsipbuilderbagit.pl
index 2ecc927..29f2ee6 100644
--- a/bin/slubsipbuilderbagit.pl
+++ b/bin/slubsipbuilderbagit.pl
@@ -282,7 +282,8 @@ package SLUB::LZA::SIPBuilderBagIt;
             say "Downloading MARC21 utility xsl '$marc_utils_url'";
             my $result = $ua->get($marc_utils_url);
             if ($result->is_error) {
-                croak "Failed to download '$marc_utils_url' (required for metadata download by PPN), " . $result->error_as_HTML;
+                print_scalar_data("", "ERROR: Failed to download '$marc_utils_url' (required for metadata download by PPN), " . $result->error_as_HTML, "", "red");
+                exit 1;
             }
             say "Saving MARC21 utility xsl to file '$marc_utils_path'";
             my $xsl = $result->decoded_content;
@@ -309,7 +310,8 @@ package SLUB::LZA::SIPBuilderBagIt;
             say "Downloading MARC21->MODS xsl '$marc_mods_url'";
             my $result = $ua->get($marc_mods_url);
             if ($result->is_error) {
-                croak "Failed to download '$marc_mods_url' (required for metadata download by PPN), " . $result->error_as_HTML;
+                print_scalar_data("", "Failed to download '$marc_mods_url' (required for metadata download by PPN), " . $result->error_as_HTML, "", "red");
+                exit 1;
             }
             say "Modifying MARC21->MODS xsl for offline use";
             $xsl = $result->decoded_content;
-- 
GitLab