Class ExceptionHandler
java.lang.Object
org.apache.pekko.http.javadsl.server.ExceptionHandler
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 -
Method Summary
Modifier and TypeMethodDescriptionasScala()static ExceptionHandlerBuilderCreates a new builder DSL for creating an ExceptionHandlerstatic ExceptionHandlerINTERNAL APIseal(RoutingSettings settings) "Seals" this handler by attaching a default handler as fallback if necessary.withFallback(ExceptionHandler that) Creates a newExceptionHandlerwhich uses the given one as fallback for this one.
-
Constructor Details
-
ExceptionHandler
public ExceptionHandler()
-
-
Method Details
-
newBuilder
Creates a new builder DSL for creating an ExceptionHandler- Returns:
- (undocumented)
-
of
INTERNAL API -
asScala
-
withFallback
Creates a newExceptionHandlerwhich uses the given one as fallback for this one.- Parameters:
that- (undocumented)- Returns:
- (undocumented)
-
seal
"Seals" this handler by attaching a default handler as fallback if necessary.- Parameters:
settings- (undocumented)- Returns:
- (undocumented)
-