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 the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.