Class KiwiRunnables.RunResult

java.lang.Object
org.kiwiproject.beta.base.KiwiRunnables.RunResult
Enclosing class:
KiwiRunnables

public static class KiwiRunnables.RunResult extends Object
Represents the result of an attempt to run a KiwiRunnables.ThrowingRunnable.
  • Method Details

    • ofSuccess

      public static KiwiRunnables.RunResult ofSuccess()
      Create a new "successfully run" instance.
      Returns:
      a new instance representing a successful run
    • ofError

      public static KiwiRunnables.RunResult ofError(Exception exception)
      Create a new "failed run" instance.
      Parameters:
      exception - the error that occurred while running an object
      Returns:
      a new instance representing the failed run
    • success

      public boolean success()
      Returns:
      true if the operation succeeded, otherwise false
    • hasError

      public boolean hasError()
      Returns:
      true if the operation failed, otherwise false
    • error

      public @Nullable Exception error()
      If an error occurred while running an object, this contains the Exception that was thrown. If there was no error, this will be null.