Skip to content

Commit

Permalink
Processed review comment
Browse files Browse the repository at this point in the history
  • Loading branch information
ramondeklein committed Apr 17, 2024
1 parent 1875677 commit 7ebad7b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 4 additions & 2 deletions internal/keystore/azure/error.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ package azure
import (
"encoding/json"
"errors"
"log/slog"

"github.com/Azure/azure-sdk-for-go/sdk/azcore"
)
Expand All @@ -28,8 +29,9 @@ func transportErrToStatus(err error) (status, error) {
if errors.As(err, &rerr) {
var errorResponse errorResponse
if rerr.RawResponse != nil {
err = json.NewDecoder(rerr.RawResponse.Body).Decode(&errorResponse)
if err != nil {
jsonErr := json.NewDecoder(rerr.RawResponse.Body).Decode(&errorResponse)
if jsonErr != nil {
slog.Error("error deserializing Azure KeyVault error message: %v", jsonErr)
return status{}, err
}
}
Expand Down
2 changes: 1 addition & 1 deletion internal/keystore/azure/key-vault.go
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,7 @@ func (s *Store) purgeWithRetry(ctx context.Context, name string, retries int) (s
return stat, fmt.Errorf("azure: failed to delete '%s': %s (%s)", name, stat.Message, stat.ErrorCode)
}
switch {
case stat.StatusCode == http.StatusOK:
case stat.StatusCode == http.StatusOK || stat.StatusCode == http.StatusNotFound:
return stat, nil
case stat.StatusCode == http.StatusForbidden && stat.ErrorCode == "ForbiddenByPolicy":
return stat, nil
Expand Down

0 comments on commit 7ebad7b

Please sign in to comment.