Skip to content

Extract missing fields to MissingParameterException #283

@ghost

Description

Extract missing fields information from MissingParameterException in case of the exception.

Example:

public static class DefaultExceptionHandler implements IExceptionHandler {
    public List<Object> handleException(ParameterException ex, PrintStream out, Help.Ansi ansi, String... args) {
        if (ex instanceof MissingParameterException) {
            MissingParameterException missingParameterException = (MissingParameterException) ex;

            out.println("Missing parameters: " + missingParameterException.getMissingFields());
        } else if (ex instanceof UnmatchedArgumentException) {
            out.println("Unknown parameters:" + ex.getCommandLine().getUnmatchedArguments());
        } else {
            out.println(ex.getMessage());
        }

        return Collections.emptyList();
    }
}

Proposal:

Add the method getMissingFields that returns the associated missing fields.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions