Skip to content

Commit

Permalink
Add another non-standard error code for RP registration (#20860)
Browse files Browse the repository at this point in the history
  • Loading branch information
jhendrixMSFT authored May 16, 2023
1 parent 2d655f3 commit 6879d7e
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion sdk/azcore/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

### Bugs Fixed
* Retry policy always clones the underlying `*http.Request` before invoking the next policy.
* Added `MissingRegistrationForResourceProvider` to the list of error codes for unregistered resource providers.
* Added some non-standard error codes to the list of error codes for unregistered resource providers.

### Other Changes

Expand Down
1 change: 1 addition & 0 deletions sdk/azcore/arm/runtime/policy_register_rp.go
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,7 @@ func (r *rpRegistrationPolicy) Do(req *azpolicy.Request) (*http.Response, error)
var unregisteredRPCodes = []string{
"MissingSubscriptionRegistration",
"MissingRegistrationForResourceProvider",
"Subscription Not Registered",
}

func isUnregisteredRPCode(errorCode string) bool {
Expand Down
5 changes: 5 additions & 0 deletions sdk/azcore/arm/runtime/policy_register_rp_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -412,6 +412,11 @@ func TestRPRegistrationPolicyEnvironmentsInSubExceeded(t *testing.T) {
require.EqualValues(t, 0, logEntries)
}

func TestIsUnregisteredRPCode(t *testing.T) {
require.True(t, isUnregisteredRPCode("Subscription Not Registered"))
require.False(t, isUnregisteredRPCode("Your subscription isn't registered"))
}

type fakeClient struct {
ep string
pl runtime.Pipeline
Expand Down

0 comments on commit 6879d7e

Please sign in to comment.