Skip to content

Commit c246ba5

Browse files
committed
check-regex-support: print easy errors to stdout
This makes it easier to debug my higher-level toolchain
1 parent 0003b1e commit c246ba5

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/validate/check-regex-support.pl

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,17 +43,20 @@
4343
# Parse args
4444
my $jsonFile = $ARGV[0];
4545
if (not -f $jsonFile) {
46-
die "Error, no such file $jsonFile\n";
46+
print "Error, no such file $jsonFile\n";
47+
exit 1;
4748
}
4849
my $json = decode_json(`cat $jsonFile`);
4950

5051
for my $key ("language", "pattern") {
5152
if (not defined($json->{$key})) {
52-
die "Error, undefined field: <$key>\n";
53+
print "Error, undefined field: <$key>\n";
54+
exit 1;
5355
}
5456
}
5557
if (not exists $language2validator{$json->{language}}) {
56-
die "Error, unsupported language $json->{language}\n";
58+
print "Error, unsupported language $json->{language}\n";
59+
exit 1;
5760
}
5861

5962
my $result = $json;

0 commit comments

Comments
 (0)