Handle HTTP errors returned by the API server

def contrail_error_handler(f):
    """Handle HTTP errors returned by the API server
    """
    @wraps(f)
    def wrapper(*args, **kwargs):
        try:
            return f(*args, **kwargs)
        except HttpError as e:
            # Replace message by details to provide a
            # meaningful message
            if e.details:
                e.message, e.details = e.details, e.message
                e.args = ("%s (HTTP %s)" % (e.message, e.http_status),)
            raise
    return wrapper