Execute method with arg and return the result.

    If the method fails, return a RayTaskError so it can be sealed in the
    resultOID and retried by user.

def _execute_and_seal_error(method, arg, method_name):
    """Execute method with arg and return the result.

    If the method fails, return a RayTaskError so it can be sealed in the
    resultOID and retried by user.
    """
    try:
        return method(arg)
    except Exception:
        return ray.worker.RayTaskError(method_name, traceback.format_exc())