Class CliError

All Implemented Interfaces:
Serializable

public final class CliError extends RuntimeException
Throw this exception to cause the CLI to exit with a message and code.
See Also:
  • Field Details

    • code

      public final int code
  • Constructor Details

    • CliError

      public CliError(String message)
      Exits the CLI with a message and an error code of 1.
      Parameters:
      message - Message to output.
    • CliError

      public CliError(String message, int code)
      Parameters:
      message - Message to use in the exception.
      code - Exit code to set.
    • CliError

      public CliError(String message, int code, Throwable previous)
      Parameters:
      message - Message to use in the exception.
      code - Exit code to set.
      previous - Previous exception.
  • Method Details

    • wrap

      public static CliError wrap(Throwable e)
      Wraps the given exception in a CliError (no wrapping is performed if the given exception is an instance of CliError).
      Parameters:
      e - Exception to wrap.
      Returns:
      Returns the wrapped exception.