Class Handle
java.lang.Object
com.marcusslover.plus.lib.exception.Handle
Simple class to handle lines of code that require try-catch statements in a cleaner fashion.
-
Method Summary
Modifier and TypeMethodDescriptionstatic voidsanitizeStackTrace(Throwable throwable, int linesToRemove) static <T extends Exception>
voidthrowable(ThrowableRunnable<T> handler) static <T extends Exception>
voidthrowable(ThrowableRunnable<T> handler, Consumer<EscapedException> error) static <T extends Exception>
voidthrowable(ThrowableRunnable<T> handler, Consumer<EscapedException> error, ThrowableRunnable<T> finallyHandler) throwable(ThrowableSupplier<T, V> supplier) throwable(ThrowableSupplier<T, V> supplier, Consumer<Exception> error) throwable(ThrowableSupplier<T, V> supplier, Consumer<Exception> error, Runnable finallyHandle) static <T extends Exception,A extends AutoCloseable>
voidwithResource(ThrowableSupplier<T, A> supplier, ThrowableConsumer<T, A> consumer) static <T extends Exception,A extends AutoCloseable>
voidwithResource(ThrowableSupplier<T, A> supplier, ThrowableConsumer<T, A> consumer, Consumer<Exception> error) static <T extends Exception,A extends AutoCloseable>
voidwithResource(ThrowableSupplier<T, A> supplier, ThrowableConsumer<T, A> consumer, Consumer<Exception> error, ThrowableRunnable<T> finallyHandle)
-
Method Details
-
throwable
-
throwable
public static <T extends Exception,V> Optional<V> throwable(ThrowableSupplier<T, V> supplier, Consumer<Exception> error) -
throwable
-
throwable
-
throwable
public static <T extends Exception> void throwable(ThrowableRunnable<T> handler, Consumer<EscapedException> error) -
throwable
public static <T extends Exception> void throwable(ThrowableRunnable<T> handler, Consumer<EscapedException> error, ThrowableRunnable<T> finallyHandler) -
withResource
public static <T extends Exception,A extends AutoCloseable> void withResource(ThrowableSupplier<T, A> supplier, ThrowableConsumer<T, A> consumer) -
withResource
public static <T extends Exception,A extends AutoCloseable> void withResource(ThrowableSupplier<T, A> supplier, ThrowableConsumer<T, A> consumer, Consumer<Exception> error) -
withResource
public static <T extends Exception,A extends AutoCloseable> void withResource(ThrowableSupplier<T, A> supplier, ThrowableConsumer<T, A> consumer, Consumer<Exception> error, ThrowableRunnable<T> finallyHandle) -
sanitizeStackTrace
-