Skip to content

Commit

Permalink
Add error message for missing keys
Browse files Browse the repository at this point in the history
  • Loading branch information
jungaretti authored May 12, 2022
1 parent 952ff9f commit bd2115f
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions pkg/porkbun/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,14 @@ func ping(auth PorkAuth) error {
YourIp string `json:"yourIp"`
}

// Show a more helpful error message when keys are missing
if auth.ApiKey == "" {
return fmt.Errorf("API key is missing")
}
if auth.SecretApiKey == "" {
return fmt.Errorf("secret API key is missing")
}

body, err := helpers.PostJsonAndRead(PING, auth)
if err != nil {
return err
Expand Down

0 comments on commit bd2115f

Please # to comment.