(key=None, error_codes_pass=())
Map Azure-specific exceptions to the simplekv-API.
Map Azure-specific exceptions to the simplekv-API.
Map Azure - specific exceptions to the simplekv - API .
def map_azure_exceptions(key=None, error_codes_pass=()):
    """Map Azure-specific exceptions to the simplekv-API."""
    from azure.core.exceptions import AzureError

    try:
        yield
    except AzureError as ex:
        error_code = getattr(ex, "error_code", None)
        if error_code is not None and error_code in error_codes_pass:
            return
        if error_code == "BlobNotFound":
            raise KeyError(key)
        raise IOError(str(ex))
def map_azure_exceptions ( key = None , error_codes_pass = ( ) ) : from azure . core . exceptions import AzureError try : yield except AzureError as ex : error_code = getattr ( ex , "error_code" , None ) if error_code is not None and error_code in error_codes_pass : return if error_code == "BlobNotFound" : raise KeyError ( key ) raise IOError ( str ( ex ) )