Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions src/azure-cli-core/azure/cli/core/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ def handle_exception(ex): # pylint: disable=too-many-locals, too-many-statement
from azure.core.exceptions import AzureError
from requests.exceptions import SSLError, HTTPError
from azure.cli.core import azclierror
from msal_extensions.persistence import PersistenceError
import traceback

logger.debug("azure.cli.core.util.handle_exception is called with an exception:")
Expand Down Expand Up @@ -136,6 +137,19 @@ def handle_exception(ex): # pylint: disable=too-many-locals, too-many-statement
error_msg = 'Keyboard interrupt is captured.'
az_error = azclierror.ManualInterrupt(error_msg)

elif isinstance(ex, PersistenceError):
# errno is already in strerror. str(ex) gives duplicated errno.
az_error = azclierror.CLIInternalError(ex.strerror)
if ex.errno == 0:
az_error.set_recommendation(
"Please report to us via Github: https://github.com/Azure/azure-cli/issues/20278")
elif ex.errno == -2146893813:
az_error.set_recommendation(
"Please report to us via Github: https://github.com/Azure/azure-cli/issues/20231")
elif ex.errno == -2146892987:
az_error.set_recommendation(
"Please report to us via Github: https://github.com/Azure/azure-cli/issues/21010")

else:
error_msg = "The command failed with an unexpected error. Here is the traceback:"
az_error = azclierror.CLIInternalError(error_msg)
Expand Down
2 changes: 1 addition & 1 deletion src/azure-cli-core/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
'humanfriendly~=10.0',
'jmespath',
'knack~=0.9.0',
'msal-extensions>=0.3.1,<0.4',
'msal-extensions~=1.0.0',
'msal>=1.17.0,<2.0.0',
'msrestazure~=0.6.4',
'packaging>=20.9,<22.0',
Expand Down
2 changes: 1 addition & 1 deletion src/azure-cli/requirements.py3.Darwin.txt
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ jmespath==0.9.5
jsondiff==1.3.0
knack==0.9.0
MarkupSafe==1.1.1
msal-extensions==0.3.1
msal-extensions==1.0.0
msal==1.17.0
msrest==0.6.21
msrestazure==0.6.4
Expand Down
2 changes: 1 addition & 1 deletion src/azure-cli/requirements.py3.Linux.txt
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ jmespath==0.9.5
jsondiff==1.3.0
knack==0.9.0
MarkupSafe==1.1.1
msal-extensions==0.3.1
msal-extensions==1.0.0
msal==1.17.0
msrest==0.6.21
msrestazure==0.6.4
Expand Down
2 changes: 1 addition & 1 deletion src/azure-cli/requirements.py3.windows.txt
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ jmespath==0.9.5
jsondiff==1.3.0
knack==0.9.0
MarkupSafe==1.1.1
msal-extensions==0.3.1
msal-extensions==1.0.0
msal==1.17.0
msrest==0.6.21
msrestazure==0.6.4
Expand Down