io.undertow.server.handlers

## Class ExceptionHandler

- java.lang.Object
- - io.undertow.server.handlers.ExceptionHandler

All Implemented Interfaces:
  HttpHandler

    public class ExceptionHandler
    extends Object
    implements HttpHandler

Handler that dispatches to a given handler and allows mapping exceptions to be handled by additional handlers. The order the exception handlers are added is important because of inheritance. Add all child classes before their parents in order to use different handlers.

### Field Summary

Fields
`static AttachmentKey<Throwable>` `THROWABLE`

### Constructor Summary

Constructors
Constructor and Description
`ExceptionHandler(HttpHandler handler)`

### Method Summary

All Methods Instance Methods Concrete Methods
`<T extends Throwable> ExceptionHandler` `addExceptionHandler(Class<T> clazz, HttpHandler handler)`
`void` `handleRequest(HttpServerExchange exchange)` Handle the request.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Field Detail

#### THROWABLE

    public static final AttachmentKey<Throwable> THROWABLE

### Constructor Detail

#### ExceptionHandler

    public ExceptionHandler(HttpHandler handler)

### Method Detail

#### handleRequest

    public void handleRequest(HttpServerExchange exchange)
                       throws Exception

Description copied from interface: `HttpHandler`
Handle the request.

Specified by:
  `handleRequest` in interface `HttpHandler`
Parameters:
  `exchange` - the HTTP request/response exchange
Throws:
  `Exception`

#### addExceptionHandler

    public <T extends Throwable> ExceptionHandler addExceptionHandler(Class<T> clazz,
                                                                      HttpHandler handler)