clikt / com.github.ajalt.clikt.core / UsageError

UsageError

open class UsageError : CliktError

An internal exception that signals a usage error.

The option and argument properties are used in message formatting, and can be set after the exception is created. If this is thrown inside a call to convert, the argument or option value will be set automatically

Constructors

Name Summary
<init> UsageError(text:String, paramName:String? = null, context:Context? = null, statusCode:Int= 1)
UsageError(text:String, argument:Argument, context:Context? = null, statusCode:Int= 1)
UsageError(text:String, option:Option, context:Context? = null, statusCode:Int= 1)

Properties

Name Summary
argument The argument that caused this error. This may be set after the error is thrown.var argument:Argument?
context var context:Context?
message open val message:String?
option The option that caused this error. This may be set after the error is thrown.var option:Option?
paramName The name of the parameter that caused the error. If possible, this should be set to the actual name used. If not set, it will be inferred from argument or option if either is set.var paramName:String?
statusCode The value to use as the exit code for the process. If you use CliktCommand.main, it will pass this value to exitProcess after printing message. Defaults to 1.val statusCode:Int
text Extra text to add to the message. Not all subclasses uses this.val text:String?

Functions

Name Summary
formatMessage open fun formatMessage():String
helpMessage fun helpMessage():String
inferParamName fun inferParamName():String

Inheritors

Name Summary
BadParameterValue A parameter was given the correct number of values, but of invalid format or type.open class BadParameterValue :UsageError
IncorrectArgumentValueCount An argument was supplied but the number of values supplied was incorrect.open class IncorrectArgumentValueCount :UsageError
IncorrectOptionValueCount An option was supplied but the number of values supplied to the option was incorrect.open class IncorrectOptionValueCount :UsageError
MissingParameter A required parameter was not providedopen class MissingParameter :UsageError
MutuallyExclusiveGroupException open class MutuallyExclusiveGroupException :UsageError
NoSuchOption An option was provided that does not exist.open class NoSuchOption :UsageError