(key=None, exc_pass=())
Map boto-specific exceptions to the simplekv-API.
Map boto-specific exceptions to the simplekv-API.
Map boto - specific exceptions to the simplekv - API .
def map_boto_exceptions(key=None, exc_pass=()):
    """Map boto-specific exceptions to the simplekv-API."""
    from boto.exception import BotoClientError, BotoServerError, \
        StorageResponseError
    try:
        yield
    except StorageResponseError as e:
        if e.code == 'NoSuchKey':
            raise KeyError(key)
        raise IOError(str(e))
    except (BotoClientError, BotoServerError) as e:
        if e.__class__.__name__ not in exc_pass:
            raise IOError(str(e))
def map_boto_exceptions ( key = None , exc_pass = ( ) ) : from boto . exception import BotoClientError , BotoServerError , StorageResponseError try : yield except StorageResponseError as e : if e . code == 'NoSuchKey' : raise KeyError ( key ) raise IOError ( str ( e ) ) except ( BotoClientError , BotoServerError ) as e : if e . __class__ . __name__ not in exc_pass : raise IOError ( str ( e ) )