-
Notifications
You must be signed in to change notification settings - Fork 910
Handle more error codes when an RP isn't registered #20848
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There's more than one error code returned from unregistered RPs.
We could also add a string slice to |
I'm sure I'm missing context but when I look at #20823, it looks like the error code string was just wrong and that this bug should be fixed. I can see the slight desire to look for error code strings (which should be compared case-sensitively, by the way - I mention this because I saw a call to EqualFold in #20823 but it looks that was may have been removed). But, since error codes are related to HTTP status code, the thing to check on would be BOTH status code AND error code string. |
We do already check the HTTP status code and if it's a 409 then we look for this additional information. Most services return Adding a slice of additional error codes would let customers unblock themselves if/when a service returns a non-standard error code. That said, it's probably rare enough that the extra machinery isn't worth it (I don't feel strongly about it, just throwing the idea out there). |
Who owns the code that is doing this comparison? |
It's the SDK. |
OK, so if you want to check for both strings, that's OK with me. Add a comment. |
👍 if there's one standard code, it's reasonable to assume the number of variants is small; this may be the only one. We can patch again if another variant turns up and add API if we come to believe there are many unknown variants. |
Hi @jhendrixMSFT , Thank you for fixing the issue, and I have another similar case: #19900, would you please also check it? Thanks! The error is {
"error": {
"code": "Subscription Not Registered",
"message": "Please register to Microsoft.Security in order to view your security status"
}
} |
@ms-henglu could you please add this info and the URL that's returning this error code to the issue? |
@jhendrixMSFT - Sure, it's already in this issue: #19900 With track2 sdk, creating of a Microsoft.Security/pricings@2022-03-01 resource is failing to a newly created subscription without a registered Microsoft.Security provider. │ PUT https://management.azure.com/subscriptions/[subscription-id]/providers/Microsoft.Security/pricings/VirtualMachines?api-version=2022-03-01
│ --------------------------------------------------------------------------------
│ RESPONSE 404: 404 Not Found
│ ERROR CODE: Subscription Not Registered
│ --------------------------------------------------------------------------------
│ {
│ "error": {
│ "code": "Subscription Not Registered",
│ "message": "Please register to Microsoft.Security in order to view your security status"
│ }
│ }
│ --------------------------------------------------------------------------------
│
│
╵ |
My mistake, I confused this with issue #20823 |
There's more than one error code returned from unregistered RPs.
* Retry policy will always clone the *http.Request (#20843) * Retry policy will always clone the *http.Request This ensures that the entirety of the request is restored on retries. * simplify test * Handle more error codes when an RP isn't registered (#20848) There's more than one error code returned from unregistered RPs. * Add another non-standard error code for RP registration (#20860) * Prep azcore v1.6.1 for release Cherry-picked the following commits. - a3b2c13 - 889be58 - 6879d7e
There's more than one error code returned from unregistered RPs.
Fixes #20823