All Downloads are FREE. Search and download functionalities are using the official Maven repository.

se.bjurr.violations.main.PrintExceptionMessageHandler Maven / Gradle / Ivy

The newest version!
package se.bjurr.violations.main;

import picocli.CommandLine;
import picocli.CommandLine.IExecutionExceptionHandler;
import picocli.CommandLine.ParseResult;

public class PrintExceptionMessageHandler implements IExecutionExceptionHandler {

  @Override
  public int handleExecutionException(
      final Exception ex, final CommandLine commandLine, final ParseResult parseResult)
      throws Exception {
    if (ex instanceof TooManyViolationsException) {
      System.err.println(ex.getMessage()); // NOPMD
    } else {
      ex.printStackTrace(System.err);
    }
    return 1;
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy