se.bjurr.violations.main.PrintExceptionMessageHandler Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of violations-command-line Show documentation
Show all versions of violations-command-line Show documentation
CLI find report files from static code analysis, present and optionally fail.
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;
}
}