Handle 404 on account details request
Signed-off-by: Steven4Hooisma <112615049+Steven4Hooisma@users.noreply.github.com>
This commit is contained in:
committed by
Aurélien Sibiril
parent
ca6d543eeb
commit
c5a110b7a6
@@ -177,6 +177,10 @@ func (d *UpCloudDriver) fetchAccountDetails(ctx context.Context, username string
|
|||||||
|
|
||||||
defer func() { _ = httpResp.Body.Close() }()
|
defer func() { _ = httpResp.Body.Close() }()
|
||||||
|
|
||||||
|
if httpResp.StatusCode == http.StatusNotFound {
|
||||||
|
return &upcloudAccountDetails{}, nil
|
||||||
|
}
|
||||||
|
|
||||||
if httpResp.StatusCode < 200 || httpResp.StatusCode >= 300 {
|
if httpResp.StatusCode < 200 || httpResp.StatusCode >= 300 {
|
||||||
return nil, fmt.Errorf("cannot fetch upcloud account details: unexpected status %d", httpResp.StatusCode)
|
return nil, fmt.Errorf("cannot fetch upcloud account details: unexpected status %d", httpResp.StatusCode)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user