Skip to content

Commit 4b592db

Browse files
authored
{Auth} Provide GitHub issue links for DPAPI errors (#22009)
1 parent d8f83fa commit 4b592db

File tree

5 files changed

+18
-4
lines changed

5 files changed

+18
-4
lines changed

src/azure-cli-core/azure/cli/core/util.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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)

src/azure-cli-core/setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
'humanfriendly~=10.0',
5252
'jmespath',
5353
'knack~=0.9.0',
54-
'msal-extensions>=0.3.1,<0.4',
54+
'msal-extensions~=1.0.0',
5555
'msal>=1.17.0,<2.0.0',
5656
'msrestazure~=0.6.4',
5757
'packaging>=20.9,<22.0',

src/azure-cli/requirements.py3.Darwin.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ jmespath==0.9.5
109109
jsondiff==1.3.0
110110
knack==0.9.0
111111
MarkupSafe==1.1.1
112-
msal-extensions==0.3.1
112+
msal-extensions==1.0.0
113113
msal==1.17.0
114114
msrest==0.6.21
115115
msrestazure==0.6.4

src/azure-cli/requirements.py3.Linux.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ jmespath==0.9.5
110110
jsondiff==1.3.0
111111
knack==0.9.0
112112
MarkupSafe==1.1.1
113-
msal-extensions==0.3.1
113+
msal-extensions==1.0.0
114114
msal==1.17.0
115115
msrest==0.6.21
116116
msrestazure==0.6.4

src/azure-cli/requirements.py3.windows.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ jmespath==0.9.5
109109
jsondiff==1.3.0
110110
knack==0.9.0
111111
MarkupSafe==1.1.1
112-
msal-extensions==0.3.1
112+
msal-extensions==1.0.0
113113
msal==1.17.0
114114
msrest==0.6.21
115115
msrestazure==0.6.4

0 commit comments

Comments
 (0)