Skip to content

Commit

Permalink
Further enhance help debug information
Browse files Browse the repository at this point in the history
  • Loading branch information
antfie committed Mar 8, 2024
1 parent 76e7f87 commit 9112015
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
7 changes: 6 additions & 1 deletion credentials.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,13 @@ func getCredentials(id, key string, profile string) (string, string) {
}

if !cfg.HasSection(profile) {
utils.ErrorAndExit(fmt.Sprintf("Could not find the profile [%s] within the Veracode credentials file. Do you need to specify the \"-profile xyz\" flag?. See https://docs.veracode.com/r/c_httpie_tool", profile), nil)
profileFlagHint := ""

if profile == "default" {
profileFlagHint = "Do you need to specify \"-profile xyz\"?. "
}

utils.ErrorAndExit(fmt.Sprintf("Could not find the profile [%s] within the Veracode credentials file. %sSee https://docs.veracode.com/r/c_httpie_tool#using-multiple-profiles", profile, profileFlagHint), nil)
}

id = cfg.Section(profile).Key("veracode_api_key_id").String()
Expand Down
2 changes: 1 addition & 1 deletion data/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ func (api API) makeApiRequest(apiUrl, httpMethod string) []byte {
}

if resp.StatusCode == 403 {
utils.ErrorAndExit("This request was forbidden. Ensure you can view these scans within the Veracode Platform. For help contact your Veracode administrator and refer to https://docs.veracode.com/r/c_API_roles_details", nil)
utils.ErrorAndExit("This request was forbidden. Do you need to specify a profile \"-profile xyz\"?. Is this the right profile name to use?. Ensure you can view these scans within the Veracode Platform. For help contact your Veracode administrator and refer to https://docs.veracode.com/r/c_API_roles_details", nil)
}

if resp.StatusCode != http.StatusOK {
Expand Down

0 comments on commit 9112015

Please sign in to comment.