Package rx.exceptions

Class OnErrorThrowable

All Implemented Interfaces:
Serializable

public final class OnErrorThrowable extends RuntimeException
Represents a Throwable that an Observable might notify its subscribers of, but that then can be handled by an operator that is designed to recover from or react appropriately to such an error. You can recover more information from an OnErrorThrowable than is found in a typical Throwable, such as the item the Observable was trying to emit at the time the error was encountered.
See Also:
  • Field Details

    • serialVersionUID

      private static final long serialVersionUID
      See Also:
    • hasValue

      private final boolean hasValue
    • value

      private final Object value
  • Constructor Details

    • OnErrorThrowable

      private OnErrorThrowable(Throwable exception)
    • OnErrorThrowable

      private OnErrorThrowable(Throwable exception, Object value)
  • Method Details

    • getValue

      public Object getValue()
      Get the value associated with this OnErrorThrowable
      Returns:
      the value associated with this OnErrorThrowable (or null if there is none)
    • isValueNull

      public boolean isValueNull()
      Indicates whether or not there is a value associated with this OnErrorThrowable
      Returns:
      true if there is a value associated with this OnErrorThrowable, otherwise false
    • from

      public static OnErrorThrowable from(Throwable t)
      Converts a Throwable into an OnErrorThrowable.
      Parameters:
      t - the Throwable to convert; if null, a NullPointerException is constructed
      Returns:
      an OnErrorThrowable representation of t
    • addValueAsLastCause

      public static Throwable addValueAsLastCause(Throwable e, Object value)
      Adds the given item as the final cause of the given Throwable, wrapped in OnNextValue (which extends RuntimeException).
      Parameters:
      e - the Throwable to which you want to add a cause
      value - the item you want to add to e as the cause of the Throwable
      Returns:
      the same Throwable (e) that was passed in, with value added to it as a cause