class_docstr: A wrapper around a result or an error.
  
  This is used to return data from FaultTolerantActorManager
  that allows us to distinguish between error and actual results.
class_docstr_tok: ["A","wrapper","around","a","result","or","an","error",".","This","is","used","to","return","data","from","FaultTolerantActorManager","that","allows","us","to","distinguish","between","error","and","actual","results","."]
docstr: One and only one of result or error should be set.
  
  Args:
      result: The result of the computation.
      error: Alternatively, the error that occurred during the computation.
docstr_tok: ["One","and","only","one","of","result","or","error","should","be","set",".","Args",":","result",":","The","result","of","the","computation",".","error",":","Alternatively",",","the","error","that","occurred","during","the","computation","."]
code: def __init__(self, result: Any = None, error: Exception = None):
      """One and only one of result or error should be set.
  
      Args:
          result: The result of the computation.
          error: Alternatively, the error that occurred during the computation.
      """
      # Note(jungong) : None is a valid result if the remote function
      # does not return anything.
      self._result = result
      # Easier to handle if we show the user the original error.
      self._error = (
          error.as_instanceof_cause()
          if isinstance(error, RayTaskError)
          else error
      )
  
imports: from collections import defaultdict
  import copy
  from dataclasses import dataclass
  import logging
  import sys
  import time
  from typing import Any, Callable, Dict, Iterator, List, Mapping, Optional, Tuple, Union
  import ray
  from ray.actor import ActorHandle
  from ray.exceptions import RayActorError, RayError, RayTaskError
  from ray.rllib.utils.typing import T
  from ray.util.annotations import DeveloperAPI
label_desc: Use image node_id 1 to create a new ResultOrError object  with example: obj = ResultOrError(result, error)