The onErrorMap operator

Reactor's onErrorMap operator allows us to convert an exception of one type to another type. Unlike the previous two operators, the onErrorMap operator requires an error callback to be configured with the subscriber. If no handler is configured, the subscriber throws back an ErrorCallbackNotImplemented exception. The onErrorMap operator provides overloaded functions, similar to the previous operators, which can be used to match exceptions based on type or a provided predicate.

Now, let's build a simple test case to validate our understanding of the onErrorMap operator:

    @Test    public void testErrorMap() {        Flux<Long> fibonacciGenerator = Flux.generate(() -> Tuples.<Long,                Long>of(0L, 1L), (state, sink) -> { // Removed ...

Get Hands-On Reactive Programming with Reactor now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.