Top Description Inners Fields Constructors Methods
rx.exceptions

public final Class OnErrorThrowable

extends RuntimeException
Class Inheritance
Imports
java.io.*, java.util.*, rx.plugins.*

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.

Nested and Inner Type Summary

Modifier and TypeClass and Description
public 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

Modifier and TypeField and Description
private final boolean
private static final long
private final Object

Constructor Summary

AccessConstructor and Description
private
private
OnErrorThrowable(Throwable exception, Object value)

Method Summary

Modifier and TypeMethod and Description
public static Throwable

Returns:

the same Throwable (e) that was passed in, with value added to it as a cause
addValueAsLastCause
(Throwable
the Throwable to which you want to add a cause
e
,
Object
the item you want to add to e as the cause of the Throwable
value
)

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

public static OnErrorThrowable

Returns:

an OnErrorThrowable representation of t
from
(Throwable
the Throwable to convert; if null, a NullPointerException is constructed
t
)

Converts a Throwable into an OnErrorThrowable.

public Object

Returns:

the value associated with this OnErrorThrowable (or null if there is none)
getValue
()

Get the value associated with this OnErrorThrowable

public boolean

Returns:

true if there is a value associated with this OnErrorThrowable, otherwise false
isValueNull
()

Indicates whether or not there is a value associated with this OnErrorThrowable

Field Detail

hasValueback to summary
private final boolean hasValue
serialVersionUIDback to summary
private static final long serialVersionUID

Hides java.lang.RuntimeException.serialVersionUID.

valueback to summary
private final Object value

Constructor Detail

OnErrorThrowableback to summary
private OnErrorThrowable(Throwable exception)
OnErrorThrowableback to summary
private OnErrorThrowable(Throwable exception, Object value)

Method Detail

addValueAsLastCauseback to summary
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:Throwable

the Throwable to which you want to add a cause

value:Object

the item you want to add to e as the cause of the Throwable

Returns:Throwable

the same Throwable (e) that was passed in, with value added to it as a cause

fromback to summary
public static OnErrorThrowable from(Throwable t)

Converts a Throwable into an OnErrorThrowable.

Parameters
t:Throwable

the Throwable to convert; if null, a NullPointerException is constructed

Returns:OnErrorThrowable

an OnErrorThrowable representation of t

getValueback to summary
public Object getValue()

Get the value associated with this OnErrorThrowable

Returns:Object

the value associated with this OnErrorThrowable (or null if there is none)

isValueNullback to summary
public boolean isValueNull()

Indicates whether or not there is a value associated with this OnErrorThrowable

Returns:boolean

true if there is a value associated with this OnErrorThrowable, otherwise false

rx.exceptions back to summary

public Class OnErrorThrowable.OnNextValue

extends RuntimeException
Class Inheritance

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.

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv static class

Field Summary

Modifier and TypeField and Description
private static final long
private final Object

Constructor Summary

AccessConstructor and Description
public
OnNextValue(Object
the item that the Observable was trying to emit at the time of the exception
value
)

Create an OnNextValue exception and include in its error message a string representation of the item that was intended to be emitted at the time the exception was handled.

Method Summary

Modifier and TypeMethod and Description
public Object

Returns:

the item that the Observable was trying to emit at the time of the exception
getValue
()

Retrieve the item that the Observable was trying to emit at the time this exception occurred.

pack-priv static String

Returns:

a string version of the object if primitive or managed through error plugin, otherwise the class name of the object
renderValue
(Object
the item that the Observable was trying to emit at the time of the exception
value
)

Render the object if it is a basic type.

Field Detail

serialVersionUIDback to summary
private static final long serialVersionUID

Hides java.lang.RuntimeException.serialVersionUID.

valueback to summary
private final Object value

Constructor Detail

OnNextValueback to summary
public OnNextValue(Object value)

Create an OnNextValue exception and include in its error message a string representation of the item that was intended to be emitted at the time the exception was handled.

Parameters
value:Object

the item that the Observable was trying to emit at the time of the exception

Method Detail

getValueback to summary
public Object getValue()

Retrieve the item that the Observable was trying to emit at the time this exception occurred.

Returns:Object

the item that the Observable was trying to emit at the time of the exception

renderValueback to summary
pack-priv static String renderValue(Object value)

Render the object if it is a basic type. This avoids the library making potentially expensive or calls to toString() which may throw exceptions. If a specific behavior has been defined in the RxJavaErrorHandler plugin, some types may also have a specific rendering. Non-primitive types not managed by the plugin are rendered as the class name of the object.

See PR #1401 and Issue #2468 for details.

Parameters
value:Object

the item that the Observable was trying to emit at the time of the exception

Returns:String

a string version of the object if primitive or managed through error plugin, otherwise the class name of the object

rx.exceptions back to summary

pack-priv final Class OnErrorThrowable.OnNextValue.Primitives

extends Object
Class Inheritance

Field Summary

Modifier and TypeField and Description
pack-priv static final Set<Class<?>>

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
private static Set<Class<?>>
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

INSTANCEback to summary
pack-priv static final Set<Class<?>> INSTANCE

Constructor Detail

Primitivesback to summary
pack-priv Primitives()

Method Detail

createback to summary
private static Set<Class<?>> create()