Class UnhandledException

All Implemented Interfaces:
Serializable, Nestable

@Deprecated(since="2021-04-30") public class UnhandledException extends NestableRuntimeException
Deprecated.
Commons Lang 2 is in maintenance mode. Commons Lang 3 should be used instead.

Thrown when it is impossible or undesirable to consume or throw a checked exception.

This exception supplements the standard exception classes by providing a more semantically rich description of the problem.

UnhandledException represents the case where a method has to deal with a checked exception but does not wish to. Instead, the checked exception is rethrown in this unchecked wrapper.

  public void foo() {
    try {
      // do something that throws IOException
    } catch (IOException ex) {
      // don't want to or can't throw IOException from foo()
      throw new UnhandledException(ex);
    }
  }
  
Since:
2.0
See Also:
  • Constructor Details

    • UnhandledException

      public UnhandledException(Throwable cause)
      Deprecated.
      Constructs the exception using a cause.
      Parameters:
      cause - the underlying cause
    • UnhandledException

      public UnhandledException(String message, Throwable cause)
      Deprecated.
      Constructs the exception using a message and cause.
      Parameters:
      message - the message to use
      cause - the underlying cause