Skip to content

KeyVault non 404/409 exceptions raises generated exceptions  #9690

@lmazuel

Description

@lmazuel

All KeyVault are using "map_error" on 404/409, meaning everything else will raise a generated exception. Example with 403:

Traceback (most recent call last):
  File ".\hello_world.py", line 46, in <module>
    secret = client.set_secret("helloWorldSecretName", "helloWorldSecretValue", expires_on=expires)
  File "c:\users\lmazuel\git\azure-sdk-for-python\sdk\core\azure-core\azure\core\tracing\decorator.py", line 71, in wrapper_use_tracer
    return func(*args, **kwargs)
  File "c:\users\lmazuel\git\azure-sdk-for-python\sdk\keyvault\azure-keyvault-secrets\azure\keyvault\secrets\_client.py", line 112, in set_secret
    vault_base_url=self.vault_url, secret_name=name, value=value, secret_attributes=attributes, **kwargs
  File "c:\users\lmazuel\git\azure-sdk-for-python\sdk\keyvault\azure-keyvault-secrets\azure\keyvault\secrets\_shared\_generated\v7_0\operations\_key_vault_client_operations.py", line 1435, in set_secret
    raise models.KeyVaultErrorException(response, self._deserialize)
azure.keyvault.secrets._shared._generated.v7_0.models._models_py3.KeyVaultErrorException: (Forbidden) Access denied. Caller was not found on any access policy.

We should not under any circumstances raise anything from generated. We shall add a fallback to catch unexpected stuff.
While using "map_error", @johanste suggested to use a default dict for this kind of scenario
https://docs.python.org/2/library/collections.html#collections.defaultdict

Metadata

Metadata

Assignees

Labels

ClientThis issue points to a problem in the data-plane of the library.KeyVault

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions