Skip to content

Commit 55997ca

Browse files
committed
graph-error
1 parent 9263d7a commit 55997ca

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

src/azure-cli/azure/cli/command_modules/role/_msgrpah/_graph_client.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,11 @@ def _send(self, method, url, param=None, body=None, api_version=V1_0):
5757
r = send_raw_request(self._cli_ctx, method, url, resource=self._resource, uri_parameters=param,
5858
body=body)
5959
except HTTPError as ex:
60-
raise GraphError(ex.response.json()['error']['message'], ex.response) from ex
60+
# https://learn.microsoft.com/en-us/graph/errors#error-resource-type
61+
error = ex.response.json()['error']
62+
code = error['code']
63+
message = error['message']
64+
raise GraphError(f"({code}) {message}", ex.response) from ex
6165
# Other exceptions like AuthenticationError should not be handled here, so we don't catch CLIError
6266

6367
if r.text:

0 commit comments

Comments
 (0)