def wrap_exception(message):
    def decorator(f):
        def wrapper(*args, **kwargs):
            try:
                return f(*args, **kwargs)
            except DockerException as e:
                raise DockerException, \
                    DockerException(message + ': ' + e.message), \
                    sys.exc_info()[2]
            except (httplib.HTTPException, socket.error) as e:
                raise DockerException, \
                    DockerException(message + ': ' + str(e)), \
                    sys.exc_info()[2]
        return wrapper
    return decorator
dataset/ETHPy150Open codalab/codalab-cli/worker/docker_client.py/wrap_exception/original