Package 

Class OnErrorThrowable

  • All Implemented Interfaces:
    java.io.Serializable

    
    public final class OnErrorThrowable
    extends RuntimeException
                        

    Represents a {@code Throwable} that an {@code 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 {@code OnErrorThrowable} than is found in a typical {@code Throwable}, such as the item the {@code Observable} was trying to emit at the time the error was encountered.

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      public class OnErrorThrowable.OnNextValue

      Represents an exception that was encountered while trying to emit an item from an Observable, andtries to preserve that item for future use and/or reporting.

    • Field Summary

      Fields 
      Modifier and Type Field Description
      private final Object value
    • Method Summary

      Modifier and Type Method Description
      Object getValue() Get the value associated with this {@code OnErrorThrowable}
      boolean isValueNull() Indicates whether or not there is a value associated with this {@code OnErrorThrowable}
      static OnErrorThrowable from(Throwable t) Converts a Throwable into an OnErrorThrowable.
      static Throwable addValueAsLastCause(Throwable e, Object value) Adds the given item as the final cause of the given {@code Throwable}, wrapped in {@code OnNextValue} (which extends {@code RuntimeException}).
      • Methods inherited from class java.lang.Throwable

        addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, setStackTrace, toString
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • getValue

         Object getValue()

        Get the value associated with this {@code OnErrorThrowable}

      • isValueNull

         boolean isValueNull()

        Indicates whether or not there is a value associated with this {@code OnErrorThrowable}

      • addValueAsLastCause

         static Throwable addValueAsLastCause(Throwable e, Object value)

        Adds the given item as the final cause of the given {@code Throwable}, wrapped in {@code OnNextValue} (which extends {@code RuntimeException}).

        Parameters:
        e - the Throwable to which you want to add a cause
        value - the item you want to add to {@code e} as the cause of the {@code Throwable}