Skip to content

Commit bd2115f

Browse files
authored
Add error message for missing keys
1 parent 952ff9f commit bd2115f

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

pkg/porkbun/api.go

+8
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,14 @@ func ping(auth PorkAuth) error {
5757
YourIp string `json:"yourIp"`
5858
}
5959

60+
// Show a more helpful error message when keys are missing
61+
if auth.ApiKey == "" {
62+
return fmt.Errorf("API key is missing")
63+
}
64+
if auth.SecretApiKey == "" {
65+
return fmt.Errorf("secret API key is missing")
66+
}
67+
6068
body, err := helpers.PostJsonAndRead(PING, auth)
6169
if err != nil {
6270
return err

0 commit comments

Comments
 (0)