Azure / Azure/azure-cli

The CLI throw the typeerror instead of return the error detail

Open
#14,343 5 comments 1 reaction 1 assignee Claimed by @jiasli View on GitHub
act-platform-engineering-squad Core Error Handling feature-request
Dominant language
Python
Stars
4.6k
Forks
3.5k
Avg merge
3d 2h
Merged PRs (30d)
60

Description

https://github.com/Azure/azure-cli/issues/14207
In the above repro, it is expected to display the error message but actually it throw the type error. By dig deep into the issue, I found it was caused by the line
https://github.com/Azure/azure-cli/blob/dev/src/azure-cli-core/azure/cli/core/util.py#L93

It returns a string not a dictionary probably because of the ex.response.text format. If call load again, it will work.
response_dict = json.loads(ex.response.text) // the first time, the type of response_dict is string
response_dict = json.loads(ex.response.text) // the second time, the type is dictionary.

@northtyphoon @yugangw-msft

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.