git » gofer » commit 136b59b

test/util/exp: Fix handling of -clienterrorre on a non-matching error

author Alberto Bertogli
2023-07-23 21:06:52 UTC
committer Alberto Bertogli
2023-07-23 23:26:04 UTC
parent 77d963317a266044d783e30de439334f8e7d252a

test/util/exp: Fix handling of -clienterrorre on a non-matching error

test/util/exp/exp.go +4 -3

diff --git a/test/util/exp/exp.go b/test/util/exp/exp.go
index 13c3bff..06be6ab 100644
--- a/test/util/exp/exp.go
+++ b/test/util/exp/exp.go
@@ -56,10 +56,11 @@ func main() {
 	if *clientErrorRE != "" {
 		if err == nil {
 			errorf("expected client error, got nil")
+			os.Exit(exitCode)
 		}
-		matched, err := regexp.MatchString(*clientErrorRE, err.Error())
-		if err != nil {
-			errorf("regexp error: %q\n", err)
+		matched, reErr := regexp.MatchString(*clientErrorRE, err.Error())
+		if reErr != nil {
+			errorf("regexp error: %q\n", reErr)
 		}
 		if !matched {
 			errorf("client error did not match regexp: %q\n", err.Error())