Class 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 Detail

      • ExceptionHandler

        public ExceptionHandler()
    • 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
      • seal

        public ExceptionHandler seal​(RoutingSettings settings)
        "Seals" this handler by attaching a default handler as fallback if necessary.
        Parameters:
        settings - (undocumented)
        Returns:
        (undocumented)