Example usage for org.springframework.web.server WebExceptionHandler handle

List of usage examples for org.springframework.web.server WebExceptionHandler handle

Introduction

In this page you can find the example usage for org.springframework.web.server WebExceptionHandler handle.

Prototype

Mono<Void> handle(ServerWebExchange exchange, Throwable ex);

Source Link

Document

Handle the given exception.

Usage

From source file:org.springframework.web.server.handler.ExceptionHandlingWebHandler.java

@Override
public Mono<Void> handle(ServerWebExchange exchange) {
    Mono<Void> mono;//from   ww w.j a v a2 s . c om
    try {
        mono = getDelegate().handle(exchange);
    } catch (Throwable ex) {
        mono = Mono.error(ex);
    }
    for (WebExceptionHandler exceptionHandler : this.exceptionHandlers) {
        mono = mono.otherwise(ex -> exceptionHandler.handle(exchange, ex));
    }
    return mono.otherwise(ex -> handleUnresolvedException(exchange, ex));
}