@@ -61,6 +61,7 @@ def handle_exception(ex): # pylint: disable=too-many-locals, too-many-statement
6161 from azure .core .exceptions import AzureError
6262 from requests .exceptions import SSLError , HTTPError
6363 from azure .cli .core import azclierror
64+ from msal_extensions .persistence import PersistenceError
6465 import traceback
6566
6667 logger .debug ("azure.cli.core.util.handle_exception is called with an exception:" )
@@ -136,6 +137,19 @@ def handle_exception(ex): # pylint: disable=too-many-locals, too-many-statement
136137 error_msg = 'Keyboard interrupt is captured.'
137138 az_error = azclierror .ManualInterrupt (error_msg )
138139
140+ elif isinstance (ex , PersistenceError ):
141+ # errno is already in strerror. str(ex) gives duplicated errno.
142+ az_error = azclierror .CLIInternalError (ex .strerror )
143+ if ex .errno == 0 :
144+ az_error .set_recommendation (
145+ "Please report to us via Github: https://github.com/Azure/azure-cli/issues/20278" )
146+ elif ex .errno == - 2146893813 :
147+ az_error .set_recommendation (
148+ "Please report to us via Github: https://github.com/Azure/azure-cli/issues/20231" )
149+ elif ex .errno == - 2146892987 :
150+ az_error .set_recommendation (
151+ "Please report to us via Github: https://github.com/Azure/azure-cli/issues/21010" )
152+
139153 else :
140154 error_msg = "The command failed with an unexpected error. Here is the traceback:"
141155 az_error = azclierror .CLIInternalError (error_msg )
0 commit comments