handleDeclarativeJobsetBuild: handle errors from readNixFile

This commit is contained in:
Graham Christensen 2020-03-03 22:32:13 -05:00
parent eb5873ae53
commit 113a312f67
No known key found for this signature in database
GPG key ID: FE918C3A98C1030F

View file

@ -68,8 +68,14 @@ sub handleDeclarativeJobsetBuild {
my $id = $build->id; my $id = $build->id;
die "Declarative jobset build $id failed" unless $build->buildstatus == 0; die "Declarative jobset build $id failed" unless $build->buildstatus == 0;
my $declPath = ($build->buildoutputs)[0]->path; my $declPath = ($build->buildoutputs)[0]->path;
my $declText = readNixFile($declPath) my $declText = eval {
or die "Couldn't read declarative specification file $declPath: $!"; readNixFile($declPath)
};
if ($@) {
print STDERR "ERROR: failed to readNixFile $declPath: ", $@, "\n";
die;
}
my $declSpec = decode_json($declText); my $declSpec = decode_json($declText);
txn_do($db, sub { txn_do($db, sub {
my @kept = keys %$declSpec; my @kept = keys %$declSpec;