From e255781a96f53249474336d5486bf720bbd10c4e Mon Sep 17 00:00:00 2001 From: Elle Nolan Date: Wed, 3 May 2023 16:11:25 -0400 Subject: [PATCH] Return correct error in ConfigQuery During some testing, it was discovered that attempting to validate a config while passing an invalid token fails with the following error: ``` $ circleci --token "invalid-token" config validate .circleci/config.yml -v ... Error: config compilation request returned an error: %!w() ``` The behavior would previously check if an error existed, but return a different one. After fixing that, the error prints correctly. --- config/config.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/config.go b/config/config.go index d76dcad51..1affc5672 100644 --- a/config/config.go +++ b/config/config.go @@ -126,7 +126,7 @@ func (c *ConfigCompiler) ConfigQuery( return legacyResponse, nil } if originalErr != nil { - return nil, fmt.Errorf("config compilation request returned an error: %w", err) + return nil, fmt.Errorf("config compilation request returned an error: %w", originalErr) } if statusCode != 200 {