Skip to content

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

Interface IExceptionHandler

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

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

All Known Implementing Classes:
    DefaultExceptionHandler


public static interface IExceptionHandler

Represents a function that can handle a ParameterException that occurred while parsing the command line arguments.This is a functional interface whose functional method is handleException.

Implementations of this function can be passed to the #parseWithHandlers(IParseResultHandler, PrintStream, Help.Ansi, IExceptionHandler, String...) methods to handle situations when the command line could not be parsed.

Method Summary

Modifier and Type Method Description
public abstract List<Object> handleException(ParameterException ex, PrintStream out, Ansi ansi, String[] args) Handles a ParameterException that occurred while parsing the command line arguments and optionally returns a list of results.

Method Details

handleException

public abstract List<Object> handleException(ParameterException ex, PrintStream out, Ansi ansi, 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

out - the PrintStream to print help to if requested

ansi - for printing help messages using ANSI styles and colors

args - the command line arguments that could not be parsed

Returns:

a list of results, or an empty list if there are no results