Package software.amazon.smithy.cli
Class CliError
- java.lang.Object
-
- java.lang.Throwable
-
- java.lang.Exception
-
- java.lang.RuntimeException
-
- software.amazon.smithy.cli.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
-
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).
-
-
-
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.
-
-