Skip to content

Commit 155613b

Browse files
committed
Return not found error when returned count is zero
1 parent abae024 commit 155613b

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

pkg/cloud/user_credentials.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,9 @@ func (c *client) ResolveAccount(account *Account) error {
140140
resp, retErr := c.cs.Account.ListAccounts(p)
141141
if retErr != nil {
142142
return retErr
143+
} else if resp.Count == 0 {
144+
return errors.Errorf("could not find account %s in domain ID %s",
145+
account.Name, account.Domain.ID)
143146
} else if resp.Count != 1 {
144147
return errors.Errorf("expected 1 Account with account name %s in domain ID %s, but got %d",
145148
account.Name, account.Domain.ID, resp.Count)

0 commit comments

Comments
 (0)