Skip to content

Commit 095ec60

Browse files
committed
lint
1 parent 5c302e3 commit 095ec60

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

internal/namespaces/vpc/v2/custom_private_network.go

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package vpc
33
import (
44
"context"
55
"errors"
6+
"net/http"
67
"time"
78

89
"github.com/scaleway/scaleway-cli/v2/core"
@@ -727,21 +728,29 @@ func privateNetworkDeleteBuilder(c *core.Command) *core.Command {
727728

728729
return tryDeletingPrivateNetwork(ctx, api, request.Region, request.PrivateNetworkID, 5)
729730
}
731+
730732
return c
731733
}
732734

733-
func tryDeletingPrivateNetwork(ctx context.Context, api *vpc.API, region scw.Region, pnID string, retriesLeft int) (*vpc.PrivateNetwork, error) {
735+
func tryDeletingPrivateNetwork(
736+
ctx context.Context,
737+
api *vpc.API,
738+
region scw.Region,
739+
pnID string,
740+
retriesLeft int,
741+
) (*vpc.PrivateNetwork, error) {
734742
err := api.DeletePrivateNetwork(&vpc.DeletePrivateNetworkRequest{
735743
PrivateNetworkID: pnID,
736744
Region: region,
737745
}, scw.WithContext(ctx))
738746

739747
var respErr *scw.ResponseError
740-
if errors.As(err, &respErr) && respErr.StatusCode == 500 {
748+
if errors.As(err, &respErr) && respErr.StatusCode == http.StatusInternalServerError {
741749
time.Sleep(time.Second * 5)
742750
if retriesLeft > 0 {
743751
return tryDeletingPrivateNetwork(ctx, api, region, pnID, retriesLeft-1)
744752
}
745753
}
754+
746755
return nil, err
747756
}

0 commit comments

Comments
 (0)