Package rx.exceptions
Class OnErrorThrowable
- java.lang.Object
-
- java.lang.Throwable
-
- java.lang.Exception
-
- java.lang.RuntimeException
-
- rx.exceptions.OnErrorThrowable
-
- All Implemented Interfaces:
java.io.Serializable
public final class OnErrorThrowable extends java.lang.RuntimeException
Represents aThrowable
that anObservable
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 anOnErrorThrowable
than is found in a typicalThrowable
, such as the item theObservable
was trying to emit at the time the error was encountered.- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
OnErrorThrowable.OnNextValue
Represents an exception that was encountered while trying to emit an item from an Observable, and tries to preserve that item for future use and/or reporting.
-
Field Summary
Fields Modifier and Type Field Description private boolean
hasValue
private static long
serialVersionUID
private java.lang.Object
value
-
Constructor Summary
Constructors Modifier Constructor Description private
OnErrorThrowable(java.lang.Throwable exception)
private
OnErrorThrowable(java.lang.Throwable exception, java.lang.Object value)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static java.lang.Throwable
addValueAsLastCause(java.lang.Throwable e, java.lang.Object value)
Adds the given item as the final cause of the givenThrowable
, wrapped inOnNextValue
(which extendsRuntimeException
).static OnErrorThrowable
from(java.lang.Throwable t)
Converts aThrowable
into anOnErrorThrowable
.java.lang.Object
getValue()
Get the value associated with thisOnErrorThrowable
boolean
isValueNull()
Indicates whether or not there is a value associated with thisOnErrorThrowable
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
- See Also:
- Constant Field Values
-
hasValue
private final boolean hasValue
-
value
private final java.lang.Object value
-
-
Method Detail
-
getValue
public java.lang.Object getValue()
Get the value associated with thisOnErrorThrowable
- Returns:
- the value associated with this
OnErrorThrowable
(ornull
if there is none)
-
isValueNull
public boolean isValueNull()
Indicates whether or not there is a value associated with thisOnErrorThrowable
- Returns:
true
if there is a value associated with thisOnErrorThrowable
, otherwisefalse
-
from
public static OnErrorThrowable from(java.lang.Throwable t)
Converts aThrowable
into anOnErrorThrowable
.- Parameters:
t
- theThrowable
to convert; if null, a NullPointerException is constructed- Returns:
- an
OnErrorThrowable
representation oft
-
addValueAsLastCause
public static java.lang.Throwable addValueAsLastCause(java.lang.Throwable e, java.lang.Object value)
Adds the given item as the final cause of the givenThrowable
, wrapped inOnNextValue
(which extendsRuntimeException
).- Parameters:
e
- theThrowable
to which you want to add a causevalue
- the item you want to add toe
as the cause of theThrowable
- Returns:
- the same
Throwable
(e
) that was passed in, withvalue
added to it as a cause
-
-