示例#1
0
def heat_exceptions(error_message):
    try:
        yield
    except heat_exc.NotFound as e:
        raise exc.OpenStackCloudResourceNotFound("{msg}: {exc}".format(
            msg=error_message, exc=str(e)))
    except Exception as e:
        raise exc.OpenStackCloudException("{msg}: {exc}".format(
            msg=error_message, exc=str(e)))
示例#2
0
def neutron_exceptions(error_message):
    try:
        yield
    except neutron_exc.NotFound as e:
        raise exc.OpenStackCloudResourceNotFound("{msg}: {exc}".format(
            msg=error_message, exc=str(e)))
    except neutron_exc.NeutronClientException as e:
        if e.status_code == 404:
            raise exc.OpenStackCloudURINotFound("{msg}: {exc}".format(
                msg=error_message, exc=str(e)))
        else:
            raise exc.OpenStackCloudException("{msg}: {exc}".format(
                msg=error_message, exc=str(e)))
    except Exception as e:
        raise exc.OpenStackCloudException("{msg}: {exc}".format(
            msg=error_message, exc=str(e)))