T
- The type of the elements that the stream emits.public interface ErrorHandlingOperators<T>
The documentation for each operator uses marble diagrams to visualize how the operator functions. Each element flowing in and out of the stream is represented as a coloured marble that has a value, with the operator applying some transformation or some side effect, termination and error signals potentially being passed, and for operators that subscribe to the stream, an output value being redeemed at the end.
Below is an example diagram labelling all the parts of the stream.
ReactiveStreams
Modifier and Type | Method and Description |
---|---|
ErrorHandlingOperators<T> |
onErrorResume(Function<Throwable,? extends T> errorHandler)
Returns a stream containing all the elements from this stream.
|
ErrorHandlingOperators<T> |
onErrorResumeWith(Function<Throwable,? extends PublisherBuilder<? extends T>> errorHandler)
Returns a stream containing all the elements from this stream.
|
ErrorHandlingOperators<T> |
onErrorResumeWithRsPublisher(Function<Throwable,? extends org.reactivestreams.Publisher<? extends T>> errorHandler)
Returns a stream containing all the elements from this stream.
|
ErrorHandlingOperators<T> onErrorResume(Function<Throwable,? extends T> errorHandler)
By default, when a stream encounters an error that prevents it from emitting the expected item to its subscriber,
the stream invokes its subscriber's onError
method, and then terminates without invoking any more
of its subscriber's methods. This operator changes this behavior. If the current stream encounters an error,
instead of invoking its subscriber's onError
method, it will instead emit the return value of the
passed function. This operator prevents errors from propagating or to supply fallback data should errors be
encountered.
errorHandler
- the function returning the value that needs to be emitting instead of the error.
The function must not return null
.ErrorHandlingOperators<T> onErrorResumeWith(Function<Throwable,? extends PublisherBuilder<? extends T>> errorHandler)
PublisherBuilder
instead.
By default, when a stream encounters an error that prevents it from emitting the expected item to its subscriber,
the stream invokes its subscriber's onError
method, and then terminates without invoking any more
of its subscriber's methods. This operator changes this behavior. If the current stream encounters an error,
instead of invoking its subscriber's onError
method, it will instead relinquish control to the
PublisherBuilder
returned from the given function, which invokes the subscriber's onNext
method if it is able to do so. The subscriber's original Subscription
is used to
control the flow of elements both before and after any error occurring.
In such a case, because no publisher necessarily invokes onError
on the stream's subscriber,
it may never know that an error happened.
errorHandler
- the function returning the stream that needs to be emitting instead of the error.
The function must not return null
.ErrorHandlingOperators<T> onErrorResumeWithRsPublisher(Function<Throwable,? extends org.reactivestreams.Publisher<? extends T>> errorHandler)
Publisher
instead.
By default, when a stream encounters an error that prevents it from emitting the expected item to its subscriber,
the stream invokes its subscriber's onError
method, and then terminates without invoking any more
of its subscriber's methods. This operator changes this behavior. If the current stream encounters an error,
instead of invoking its subscriber's onError
method, the subscriber will be fed from the
Publisher
returned from the given function, and the subscriber's onNext
method is called as the returned Publisher publishes. The subscriber's original Subscription
is used to
control the flow of both the original and the onError Publishers' elements.
In such a case, because no publisher necessarily invokes onError
,
the subscriber may never know that an error happened.
errorHandler
- the function returning the stream that need to be emitting instead of the error.
The function must not return null
.Copyright © 2019 Eclipse Foundation. All rights reserved.