Package ch.codexs.util
Class Result.Catcher<E extends java.lang.Throwable>
- java.lang.Object
-
- ch.codexs.util.Result.Catcher<E>
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <T> Result<T,E>run(Result.ThrowingSupplier<T,E> supplier)Runs the providedThrowingSupplier, gets its result and build aResultout of it.
-
-
-
Method Detail
-
run
public <T> Result<T,E> run(Result.ThrowingSupplier<T,E> supplier)
Runs the providedThrowingSupplier, gets its result and build aResultout of it. If there is a throw exception, and it is expected, it is catch and used as an issue to build the result.- Type Parameters:
T- The type of the content.- Parameters:
supplier- ThrowingSupplier providing a content. Should not providenull.- Returns:
- Result either containing the supplied content or the catch exception as an issue.
-
-