Skip to content

Commit

Permalink
Return correct error in ConfigQuery
Browse files Browse the repository at this point in the history
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(<nil>)
```

The behavior would previously check if an error existed, but return a
different one. After fixing that, the error prints correctly.
  • Loading branch information
professor-l committed May 3, 2023
1 parent cc8c4de commit e255781
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit e255781

Please sign in to comment.