-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
Raise appropriate exception when error_body is dict | Fix exception raised during handling of another exception #18147
Conversation
Hi Tamer, Thanks for having a look at this bug. I hope you don't mind, but I went down a bit of rabbit-hole on this one. What I imagine is happening is that Azure's endpoints return either XML or JSON depending on the Accept header in the request, and that applies to error responses as well as 200s. So, the
We could tweak the existing code to handle either scenario, plus have a half-way decent fall-back if some other type, like plain text, comes back.
The code above is repetitive and still has some problems, like what if our message doesn't have "code" and "message" fields? Then One idea would be to coerce the one case into the other:
I hope this helps, |
Hi @cbare I've spent some time to dig deeper into our error handling. This is also why I don't think there is a case where we would encounter an undefined error code/message since the three cases (error in headers and not body, error in xml body, error in JSON body) should cover everything. I do like your second recommendation, it's very concise. I will make some few tweaks to account for the case I mentioned earlier (error code and message in headers + empty body) Thank you very much @cbare :) |
No pipelines are associated with this pull request. |
/azp run python - storage - ci |
Azure Pipelines successfully started running 1 pipeline(s). |
/azp run python - storage - ci |
Azure Pipelines successfully started running 1 pipeline(s). |
/azp run python - storage - ci |
Azure Pipelines successfully started running 1 pipeline(s). |
/azp run python - storage - ci |
Azure Pipelines successfully started running 1 pipeline(s). |
This resolves #18129, Azure/azure-cli#16217 and #15956
This PR will improve error handling in the following ways:
error occurred during handling of the above exception