Skip to content

Package io.github.qishr.cascara.common.util

Interface IParameterExceptionHandler

java.lang.Object
        io.github.qishr.cascara.common.util.CommandLine.IParameterExceptionHandler

Enclosing Class:
    io.github.qishr.cascara.common.util.CommandLine


public static interface IParameterExceptionHandler

Classes implementing this interface know how to handle ParameterExceptions (usually from invalid user input).

Implementation Requirements:

Implementors that need to print messages to the console should use the output and error PrintWriters, and the color scheme from the CommandLine object obtained from the exception.

Implementation Note:

See #getParameterExceptionHandler() for a description of the default handler.

API Note:

This interface supersedes IExceptionHandler2.

Method Summary

Modifier and Type Method Description
public abstract int handleParseException(ParameterException ex, String[] args) Handles a ParameterException that occurred while parsing the command line arguments and returns an exit code suitable for returning from #execute(String...).

Method Details

handleParseException

public abstract int handleParseException(ParameterException ex, String[] args)

Handles a ParameterException that occurred while parsing the command line arguments and returns an exit code suitable for returning from #execute(String...).

Parameters:

ex - the ParameterException describing the problem that occurred while parsing the command line arguments, and the CommandLine representing the command or subcommand whose input was invalid

args - the command line arguments that could not be parsed

Returns:

an exit code

Throws:

Exception