Package rx.exceptions
Class OnErrorThrowable
java.lang.Object
java.lang.Throwable
java.lang.Exception
java.lang.RuntimeException
rx.exceptions.OnErrorThrowable
- All Implemented Interfaces:
Serializable
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:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
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
FieldsModifier and TypeFieldDescriptionprivate final boolean
private static final long
private final Object
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprivate
OnErrorThrowable
(Throwable exception) private
OnErrorThrowable
(Throwable exception, Object value) -
Method Summary
Modifier and TypeMethodDescriptionstatic Throwable
addValueAsLastCause
(Throwable e, Object value) Adds the given item as the final cause of the givenThrowable
, wrapped inOnNextValue
(which extendsRuntimeException
).static OnErrorThrowable
Converts aThrowable
into anOnErrorThrowable
.getValue()
Get the value associated with thisOnErrorThrowable
boolean
Indicates whether or not there is a value associated with thisOnErrorThrowable
Methods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
Field Details
-
serialVersionUID
private static final long serialVersionUID- See Also:
-
hasValue
private final boolean hasValue -
value
-
-
Constructor Details
-
OnErrorThrowable
-
OnErrorThrowable
-
-
Method Details
-
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
Converts aThrowable
into anOnErrorThrowable
.- Parameters:
t
- theThrowable
to convert; if null, a NullPointerException is constructed- Returns:
- an
OnErrorThrowable
representation oft
-
addValueAsLastCause
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
-