forked from TrueCloudLab/lego
Update error messages for DNSimple provider (#373)
This commit is contained in:
parent
1293a4a35b
commit
7668fe9274
2 changed files with 4 additions and 4 deletions
|
@ -32,7 +32,7 @@ func NewDNSProvider() (*DNSProvider, error) {
|
||||||
// DNSProvider instance configured for dnsimple.
|
// DNSProvider instance configured for dnsimple.
|
||||||
func NewDNSProviderCredentials(accessToken, baseUrl string) (*DNSProvider, error) {
|
func NewDNSProviderCredentials(accessToken, baseUrl string) (*DNSProvider, error) {
|
||||||
if accessToken == "" {
|
if accessToken == "" {
|
||||||
return nil, fmt.Errorf("DNSimple OAuth token missing")
|
return nil, fmt.Errorf("DNSimple OAuth token is missing")
|
||||||
}
|
}
|
||||||
|
|
||||||
client := dnsimple.NewClient(dnsimple.NewOauthTokenCredentials(accessToken))
|
client := dnsimple.NewClient(dnsimple.NewOauthTokenCredentials(accessToken))
|
||||||
|
@ -173,7 +173,7 @@ func (c *DNSProvider) getAccountID() (string, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if whoamiResponse.Data.Account == nil {
|
if whoamiResponse.Data.Account == nil {
|
||||||
return "", fmt.Errorf("DNSimple API returned empty account ID")
|
return "", fmt.Errorf("DNSimple user tokens are not supported, please use an account token.")
|
||||||
}
|
}
|
||||||
|
|
||||||
return strconv.Itoa(whoamiResponse.Data.Account.ID), nil
|
return strconv.Itoa(whoamiResponse.Data.Account.ID), nil
|
||||||
|
|
|
@ -74,7 +74,7 @@ func TestNewDNSProviderInvalidWithMissingOauthToken(t *testing.T) {
|
||||||
provider, err := NewDNSProvider()
|
provider, err := NewDNSProvider()
|
||||||
|
|
||||||
assert.Nil(t, provider)
|
assert.Nil(t, provider)
|
||||||
assert.EqualError(t, err, "DNSimple OAuth token missing")
|
assert.EqualError(t, err, "DNSimple OAuth token is missing")
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -102,7 +102,7 @@ func TestNewDNSProviderCredentialsInvalidWithMissingOauthToken(t *testing.T) {
|
||||||
provider, err := NewDNSProviderCredentials("", "")
|
provider, err := NewDNSProviderCredentials("", "")
|
||||||
|
|
||||||
assert.Nil(t, provider)
|
assert.Nil(t, provider)
|
||||||
assert.EqualError(t, err, "DNSimple OAuth token missing")
|
assert.EqualError(t, err, "DNSimple OAuth token is missing")
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
Loading…
Reference in a new issue