From c741576563118732b4c0741f14d634af397336c2 Mon Sep 17 00:00:00 2001
From: Michael Bishop <michael.bishop@iohk.io>
Date: Tue, 11 Sep 2018 08:03:58 -0300
Subject: [PATCH] improve the error messages when invalid declarative jobsets
 are defined

(cherry picked from commit 7568b89a1a9da3a58a0cdddc7b5bcea7bb6209d8)
---
 src/lib/Hydra/Helper/AddBuilds.pm | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/src/lib/Hydra/Helper/AddBuilds.pm b/src/lib/Hydra/Helper/AddBuilds.pm
index 37061425..40375c6b 100644
--- a/src/lib/Hydra/Helper/AddBuilds.pm
+++ b/src/lib/Hydra/Helper/AddBuilds.pm
@@ -76,7 +76,12 @@ sub handleDeclarativeJobsetBuild {
             push @kept, ".jobsets";
             $project->jobsets->search({ name => { "not in" => \@kept } })->update({ enabled => 0, hidden => 1 });
             while ((my $jobsetName, my $spec) = each %$declSpec) {
-                updateDeclarativeJobset($db, $project, $jobsetName, $spec);
+                eval {
+                    updateDeclarativeJobset($db, $project, $jobsetName, $spec);
+                };
+                if ($@) {
+                    print STDERR "ERROR: failed to process declarative jobset ", $project->name, ":${jobsetName}, ", $@, "\n";
+                }
             }
         });
     };