Class RethrowUtilsKt
-
- All Implemented Interfaces:
public final class RethrowUtilsKt
-
-
Method Summary
Modifier and Type Method Description final static <T extends Any> Tfail(String message)Throws assertion error with the specified message final static <T extends Any> Tfail(String message, Throwable cause)Throws assertion error with the specified message final static BooleanisFailure(Throwable e)Checks if the error should be ever caught, i.e. final static UnitthrowIfFailure(Throwable e)Throws the specified error if isFailure final static <R extends Any> RrethrowAsIs(ThrowingSupplier<R> block)Throws caught error as is (allows Java to erase trace of checked exception with no change) final static UnitrethrowAsIs(ThrowingRunnable block)Throws caught error as is (allows Java to erase trace of checked exception with no change) final static <R extends Any> RrethrowChecked(ThrowingSupplier<R> block)Throws caught error as is if isFailure or RuntimeException else wrapped as runtime final static UnitrethrowChecked(ThrowingRunnable block)Throws caught error as is if isFailure or RuntimeException else wrapped as runtime final static <R extends Any> Rrethrow(String message, ThrowingSupplier<R> block)Throws caught error as is if isFailure else wrapped as RuntimeException with the specified message final static <R extends Any> Rrethrow(ThrowingSupplier<R> block)Throws caught error as is if isFailure else wrapped as RuntimeException with the specified message final static Unitrethrow(String message, ThrowingRunnable block)Throws caught error as is if isFailure else wrapped as RuntimeException with the specified message final static Unitrethrow(ThrowingRunnable block)Throws caught error as is if isFailure else wrapped as RuntimeException with the specified message -
-
Method Detail
-
fail
@Contract(value = "_ -> fail") final static <T extends Any> T fail(String message)
Throws assertion error with the specified message
-
fail
@Contract(value = "_,_ -> fail") final static <T extends Any> T fail(String message, Throwable cause)
Throws assertion error with the specified message
-
isFailure
final static Boolean isFailure(Throwable e)
Checks if the error should be ever caught, i.e., if it is VirtualMachineError, ThreadDeath, InterruptedException, LinkageError.
-
throwIfFailure
final static Unit throwIfFailure(Throwable e)
Throws the specified error if isFailure
-
rethrowAsIs
final static <R extends Any> R rethrowAsIs(ThrowingSupplier<R> block)
Throws caught error as is (allows Java to erase trace of checked exception with no change)
-
rethrowAsIs
final static Unit rethrowAsIs(ThrowingRunnable block)
Throws caught error as is (allows Java to erase trace of checked exception with no change)
-
rethrowChecked
final static <R extends Any> R rethrowChecked(ThrowingSupplier<R> block)
Throws caught error as is if isFailure or RuntimeException else wrapped as runtime
-
rethrowChecked
final static Unit rethrowChecked(ThrowingRunnable block)
Throws caught error as is if isFailure or RuntimeException else wrapped as runtime
-
rethrow
@JvmOverloads() final static <R extends Any> R rethrow(String message, ThrowingSupplier<R> block)
Throws caught error as is if isFailure else wrapped as RuntimeException with the specified message
-
rethrow
@JvmOverloads() final static <R extends Any> R rethrow(ThrowingSupplier<R> block)
Throws caught error as is if isFailure else wrapped as RuntimeException with the specified message
-
rethrow
@JvmOverloads() final static Unit rethrow(String message, ThrowingRunnable block)
Throws caught error as is if isFailure else wrapped as RuntimeException with the specified message
-
rethrow
@JvmOverloads() final static Unit rethrow(ThrowingRunnable block)
Throws caught error as is if isFailure else wrapped as RuntimeException with the specified message
-
-
-
-