(key=None, exc_pass=())
Map boto3-specific exceptions to the simplekv-API.
Map boto3-specific exceptions to the simplekv-API.
Map boto3 - specific exceptions to the simplekv - API .
def map_boto3_exceptions(key=None, exc_pass=()):
    """Map boto3-specific exceptions to the simplekv-API."""
    from botocore.exceptions import ClientError

    try:
        yield
    except ClientError as ex:
        code = ex.response['Error']['Code']
        if code == '404' or code == 'NoSuchKey':
            raise KeyError(key)
        raise IOError(str(ex))
def map_boto3_exceptions ( key = None , exc_pass = ( ) ) : from botocore . exceptions import ClientError try : yield except ClientError as ex : code = ex . response [ 'Error' ] [ 'Code' ] if code == '404' or code == 'NoSuchKey' : raise KeyError ( key ) raise IOError ( str ( ex ) )