类 Throwables


  • public final class Throwables
    extends Object
    Miscellaneous functions dealing with Throwable.
    从以下版本开始:
    4.12
    • 方法详细资料

      • rethrowAsException

        public static Exception rethrowAsException​(Throwable e)
                                            throws Exception
        Rethrows the given Throwable, allowing the caller to declare that it throws Exception. This is useful when your callers have nothing reasonable they can do when a Throwable is thrown. This is declared to return Exception so it can be used in a throw clause:
         try {
           doSomething();
         } catch (Throwable e} {
           throw Throwables.rethrowAsException(e);
         }
         doSomethingLater();
         
        参数:
        e - exception to rethrow
        返回:
        does not return anything
        抛出:
        Exception
        从以下版本开始:
        4.12