Class CliError

  • All Implemented Interfaces:
    java.io.Serializable

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

      Fields 
      Modifier and Type Field Description
      int code  
    • Constructor Summary

      Constructors 
      Constructor Description
      CliError​(java.lang.String message)
      Exits the CLI with a message and an error code of 1.
      CliError​(java.lang.String message, int code)  
      CliError​(java.lang.String message, int code, java.lang.Throwable previous)  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static CliError wrap​(java.lang.Throwable e)
      Wraps the given exception in a CliError (no wrapping is performed if the given exception is an instance of CliError).
      • Methods inherited from class java.lang.Throwable

        addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Field Detail

      • code

        public final int code
    • Constructor Detail

      • CliError

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

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

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

      • wrap

        public static CliError wrap​(java.lang.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.