Top Description Fields Constructors Methods
rx.plugins

public abstract Class RxJavaErrorHandler

extends Object
Class Inheritance
Imports
rx.*, rx.exceptions.Exceptions

Abstract class for defining error handling logic in addition to the normal Subscriber#onError(Throwable) behavior.

For example, all Exceptions can be logged using this handler even if Subscriber#onError(Throwable) is ignored or not provided when an Observable is subscribed to.

This plugin is also responsible for augmenting rendering of OnErrorThrowable.OnNextValue.

See RxJavaPlugins or the RxJava GitHub Wiki for information on configuring plugins: https://github.com/ReactiveX/RxJava/wiki/Plugins.

Field Summary

Modifier and TypeField and Description
protected static final String

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public void
handleError(Throwable
the Exception
e
)

Deprecated
Receives all Exceptions from an Observable passed to Subscriber#onError(Throwable).
public final String

Returns:

a short String representation of the item if one is known for its type, or null for default
handleOnNextValueRendering
(Object
the last emitted item, that caused the exception wrapped in OnErrorThrowable.OnNextValue
item
)

Receives items causing OnErrorThrowable.OnNextValue and gives a chance to choose the String representation of the item in the OnNextValue stacktrace rendering.

protected String

Returns:

a short String representation of the item if one is known for its type, or null for default
render
(Object
the last emitted item, that caused the exception wrapped in OnErrorThrowable.OnNextValue
item
)

Override this method to provide rendering for specific types other than primitive types and null.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

ERROR_IN_RENDERING_SUFFIXback to summary
protected static final String ERROR_IN_RENDERING_SUFFIX

Constructor Detail

RxJavaErrorHandlerback to summary
public RxJavaErrorHandler()

Method Detail

handleErrorback to summary
public void handleError(Throwable e)

Deprecated

Receives all Exceptions from an Observable passed to Subscriber#onError(Throwable).

This should never throw an Exception. Make sure to try/catch(Throwable) all code inside this method implementation.

Parameters
e:Throwable

the Exception

Annotations
@Deprecated
handleOnNextValueRenderingback to summary
public final String handleOnNextValueRendering(Object item)

Receives items causing OnErrorThrowable.OnNextValue and gives a chance to choose the String representation of the item in the OnNextValue stacktrace rendering. Returns null if this type of item is not managed and should use default rendering.

Note that primitive types are always rendered as their toString() value.

If a Throwable is caught when rendering, this will fallback to the item's class name suffixed by ERROR_IN_RENDERING_SUFFIX.

Parameters
item:Object

the last emitted item, that caused the exception wrapped in OnErrorThrowable.OnNextValue

Returns:String

a short String representation of the item if one is known for its type, or null for default

Since
1.3
renderback to summary
protected String render(Object item) throws InterruptedException

Override this method to provide rendering for specific types other than primitive types and null.

For performance and overhead reasons, this should should limit to a safe production of a short String (as large renderings will bloat up the stacktrace). Prefer to try/catch(Throwable) all code inside this method implementation.

If a Throwable is caught when rendering, this will fallback to the item's class name suffixed by .errorRendering.

Parameters
item:Object

the last emitted item, that caused the exception wrapped in OnErrorThrowable.OnNextValue

Returns:String

a short String representation of the item if one is known for its type, or null for default

Exceptions
InterruptedException:
if the rendering thread is interrupted
Since
1.3