{Core} aaz: Fix MgmtErrorFormat missing message from response#32927
{Core} aaz: Fix MgmtErrorFormat missing message from response#32927
aaz: Fix MgmtErrorFormat missing message from response#32927Conversation
️✔️AzureCLI-FullTest
|
️✔️AzureCLI-BreakingChangeTest
|
|
Thank you for your contribution! We will review the pull request and get back to you soon. |
|
The git hooks are available for azure-cli and azure-cli-extensions repos. They could help you run required checks before creating the PR. Please sync the latest code with latest dev branch (for azure-cli) or main branch (for azure-cli-extensions). pip install azdev --upgrade
azdev setup -c <your azure-cli repo path> -r <your azure-cli-extensions repo path>
|
There was a problem hiding this comment.
Pull request overview
Fixes AAZ ARM management error formatting so that when an ARM error response includes additionalInfo: null, the error can still be parsed and the original message is preserved/shown.
Changes:
- Treat
additionalInfoas an empty list when it is present butnullin the response JSON.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| self.additional_info = [ | ||
| TypedErrorInfo(additional_info["type"], additional_info["info"]) | ||
| for additional_info in self.get_object_prop(json_object, self.ADDITIONALINFO_LABEL, []) | ||
| for additional_info in self.get_object_prop(json_object, self.ADDITIONALINFO_LABEL, []) or [] |
There was a problem hiding this comment.
If ADDITIONALINFO_LABEL can be present but null, do we want additional_info to end up as None or consistently as an empty list? I don’t have a preference.
There was a problem hiding this comment.
it's a workaround to make it iterable in the list comprehension, previously there is an implicit error:
TypeError: 'NoneType' object is not iterablebtw, the actual logic of additional_info is
azure-cli/src/azure-cli-core/azure/cli/core/aaz/_error_format.py
Lines 142 to 145 in e6e616f
Related command
Description
when

addtionalInfoin null, returned error will missing themessagepart from the response:after that fix:

if will return complete error:
Testing Guide
History Notes
[Component Name 1] BREAKING CHANGE:
az command a: Make some customer-facing breaking change[Component Name 2]
az command b: Add some customer-facing featureThis checklist is used to make sure that common guidelines for a pull request are followed.
The PR title and description has followed the guideline in Submitting Pull Requests.
I adhere to the Command Guidelines.
I adhere to the Error Handling Guidelines.