Skip to content

Commit 3a9dc8a

Browse files
committed
better exception message
1 parent a60854c commit 3a9dc8a

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

sdk/keyvault/azure-security-keyvault/azure/security/keyvault/_internal.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
# --------------------------------------------------------------------------
66
from collections import namedtuple
77
from typing import TYPE_CHECKING
8+
89
if TYPE_CHECKING:
910
# pylint:disable=unused-import
1011
from typing import Any, Mapping, Optional
@@ -73,7 +74,9 @@ def create_config(credential, api_version=None, **kwargs):
7374
def __init__(self, vault_url, credential, config=None, transport=None, api_version=None, **kwargs):
7475
# type: (str, TokenCredential, Configuration, Optional[HttpTransport], Optional[str], **Any) -> None
7576
if not credential:
76-
raise ValueError("credential should be a credential object from azure-identity")
77+
raise ValueError(
78+
"credential should be an object supporting the TokenCredential protocol, such as a credential from azure-identity"
79+
)
7780
if not vault_url:
7881
raise ValueError("vault_url must be the URL of an Azure Key Vault")
7982

sdk/keyvault/azure-security-keyvault/azure/security/keyvault/aio/_internal.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
# license information.
55
# --------------------------------------------------------------------------
66
from typing import Any, Callable, Mapping, Optional, TYPE_CHECKING
7+
78
if TYPE_CHECKING:
89
try:
910
from azure.core.credentials import TokenCredential
@@ -70,7 +71,9 @@ def __init__(
7071
**kwargs: Any
7172
) -> None:
7273
if not credential:
73-
raise ValueError("credential should be a credential object from azure-identity")
74+
raise ValueError(
75+
"credential should be an object supporting the TokenCredential protocol, such as a credential from azure-identity"
76+
)
7477
if not vault_url:
7578
raise ValueError("vault_url must be the URL of an Azure Key Vault")
7679

0 commit comments

Comments
 (0)