Class NeverThrow

java.lang.Object
org.storynode.pigeon.function.NeverThrow

public class NeverThrow extends Object
Static functions for exception-less execution
Since:
1.0.0
Author:
Andrea Coronese
  • Constructor Details

    • NeverThrow

      public NeverThrow()
  • Method Details

    • executing

      @NotNull public static @NotNull Result<None<?>,Exception> executing(Runnable func)
      Runs the given function and returns a Result describing its outcome
      Parameters:
      func - a function to run
      Returns:
      a Result object that will contain an empty Option if the execution completed nominally or the error thrown if completed exceptionally.
    • executing

      @NotNull public static <T> @NotNull Result<T,? extends Throwable> executing(ThrowingSupplier<T> func)
      Runs the given function and returns a Result with the function returned value
      Type Parameters:
      T - the type of the return value
      Parameters:
      func - a function to run
      Returns:
      a Result object that will contain the function return value if the execution completed nominally or the error thrown if completed exceptionally.