Interface HttpException

All Superinterfaces:
QuietException
All Known Implementing Classes:
BadMessageException, HttpException.IllegalArgumentException, HttpException.IllegalStateException, HttpException.RuntimeException

public interface HttpException extends QuietException

A tagging interface for Exceptions that carry an HTTP response code and reason.

Exception subclasses that implement this interface will be caught by the container and the getCode() used to send a response.

  • Method Details

    • getCode

      int getCode()
    • getReason

      String getReason()
    • asHttpException

      static HttpException asHttpException(Throwable throwable)
    • throwAsUnchecked

      static void throwAsUnchecked(HttpException httpException)
      Throw the given HttpException as an unchecked exception.
      Parameters:
      httpException - the HttpException to throw
    • throwAsUncheckedHttpException

      static void throwAsUncheckedHttpException(Throwable throwable)
      Convert the given Throwable to an HttpException and throw it as an unchecked exception.
      Parameters:
      throwable - the Throwable to convert and throw
    • throwIfHttpException

      static void throwIfHttpException(Throwable th)
      If the given Throwable is an HttpException, throw it as an unchecked exception.
      Parameters:
      th - the Throwable to check and possibly throw