From: Jacob Bachmeyer Date: Fri, 4 Nov 2022 00:03:40 +0000 (-0500) Subject: Use structured exceptions for empty directive X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=9efffef0c9c118c38a81daff1ec25c927ca4daa6;p=gatekeeper.git Use structured exceptions for empty directive --- diff --git a/gatekeeper.pl b/gatekeeper.pl index 1e7ee35..e3bc841 100755 --- a/gatekeeper.pl +++ b/gatekeeper.pl @@ -2099,12 +2099,14 @@ sub validate_commands { # Check that we actually have at least one command in the directive unless ($#$ops > 0) { if (1 == scalar @$packet) { - fatal("nothing to do - no commands in directive file",1); + throw directive_syntax => trace => $ops, + summary => 'nothing to do - no commands in directive file'; } else { # Provide a different message if this looks like an upload packet. - fatal("no filename directive specified in $stem.directive.asc. " - ."Upgrade to the latest version! " - ."See http://www.gnu.org/prep/maintain/maintain.html",1) + throw directive_syntax => trace => $ops, + summary => "no filename element in $stem.directive.asc." + .' Upgrade to the latest version! ' + .'See http://www.gnu.org/prep/maintain/maintain.html'; } } diff --git a/testsuite/lib/gatekeeper.exp b/testsuite/lib/gatekeeper.exp index 7eefcac..8a9b1f6 100644 --- a/testsuite/lib/gatekeeper.exp +++ b/testsuite/lib/gatekeeper.exp @@ -721,7 +721,7 @@ proc analyze_log { base_dir name assess } { exp_continue } -re {^gatekeeper\[[0-9]+\]: \(Test\) \[PV\]\ - no filename directive specified in ([^\r\n]+)[.]\ + no filename element in ([^\r\n]+)[.]\ Upgrade to the latest version![^\r\n]+} { # from read_directive_file, if no filename given # This was valid in v1 but v1 is now obsolete.