Package akka.http.javadsl.server
Class ExceptionHandler
- java.lang.Object
-
- akka.http.javadsl.server.ExceptionHandler
-
public final class ExceptionHandler extends java.lang.Object
Handles exceptions by turning them into routes. You can create an exception handler in Java code like the following example:ExceptionHandler myHandler = ExceptionHandler.of (ExceptionHandler.newPFBuilder() .match(IllegalArgumentException.class, x -> Directives.complete(StatusCodes.BAD_REQUEST)) .build() ));
-
-
Constructor Summary
Constructors Constructor Description ExceptionHandler()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description ExceptionHandler
asScala()
static ExceptionHandlerBuilder
newBuilder()
Creates a new builder DSL for creating an ExceptionHandlerstatic ExceptionHandler
of(scala.PartialFunction<java.lang.Throwable,Route> pf)
INTERNAL APIExceptionHandler
seal(RoutingSettings settings)
"Seals" this handler by attaching a default handler as fallback if necessary.ExceptionHandler
withFallback(ExceptionHandler that)
Creates a newExceptionHandler
which uses the given one as fallback for this one.
-
-
-
Method Detail
-
newBuilder
public static ExceptionHandlerBuilder newBuilder()
Creates a new builder DSL for creating an ExceptionHandler- Returns:
- (undocumented)
-
of
public static ExceptionHandler of(scala.PartialFunction<java.lang.Throwable,Route> pf)
INTERNAL API
-
asScala
public ExceptionHandler asScala()
-
withFallback
public ExceptionHandler withFallback(ExceptionHandler that)
Creates a newExceptionHandler
which uses the given one as fallback for this one.- Parameters:
that
- (undocumented)- Returns:
- (undocumented)
-
seal
public ExceptionHandler seal(RoutingSettings settings)
"Seals" this handler by attaching a default handler as fallback if necessary.- Parameters:
settings
- (undocumented)- Returns:
- (undocumented)
-
-