Class ExceptionUtils

java.lang.Object
io.micronaut.core.util.ExceptionUtils

@Internal public final class ExceptionUtils extends Object
Utility methods for dealing with exceptions.
Author:
Denis Stepanov
  • Constructor Details

    • ExceptionUtils

      public ExceptionUtils()
  • Method Details

    • sneakyThrow

      public static <T extends Throwable, R> R sneakyThrow(Throwable t) throws T
      Throws a given Throwable without requiring the caller to handle it explicitly, bypassing checked exception restrictions at compile time.
      Type Parameters:
      T - the type of the throwable being thrown
      R - the return type of the method
      Parameters:
      t - the throwable instance to be thrown
      Returns:
      this method does not return normally, as it always throws the supplied throwable
      Throws:
      T - the throwable passed as the argument