Skip to content

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

Interface IExceptionHandler2

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

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

All Known Implementing Classes:
    DefaultExceptionHandler


public static interface IExceptionHandler2

Classes implementing this interface know how to handle ParameterExceptions (usually from invalid user input) and ExecutionExceptions that occurred while executing the Runnable or Callable command.

Implementations of this interface can be passed to the

parseWithHandlers(IParseResultHandler2, IExceptionHandler2, String...) method.

This interface replaces the IParseResultHandler interface.

Method Summary

Modifier and Type Method Description
public abstract R handleParseException(ParameterException ex, String[] args) Handles a ParameterException that occurred while parsing the command line arguments and optionally returns a list of results.
public abstract R handleExecutionException(ExecutionException ex, ParseResult parseResult) Handles a ExecutionException that occurred while executing the Runnable or Callable command and optionally returns a list of results.

Method Details

handleParseException

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

Handles a ParameterException that occurred while parsing the command line arguments and optionally returns a list of results.

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 object resulting from handling the exception


handleExecutionException

public abstract R handleExecutionException(ExecutionException ex, ParseResult parseResult)

Handles a ExecutionException that occurred while executing the Runnable or Callable command and optionally returns a list of results.

Parameters:

ex - the ExecutionException describing the problem that occurred while executing the Runnable or Callable command, and the CommandLine representing the command or subcommand that was being executed

parseResult - the result of parsing the command line arguments

Returns:

an object resulting from handling the exception