MCPcopy Create free account
hub / github.com/remkop/picocli / IExitCodeExceptionMapper

Interface IExitCodeExceptionMapper

src/main/java/picocli/CommandLine.java:1230–1236  ·  view source on GitHub ↗

Interface that provides the appropriate exit code that will be returned from the #execute(String...) execute method for an exception that occurred during parsing or while invoking the command's Runnable, Callable, or Method. Example usage: @Command class FailingCommand impl

Source from the content-addressed store, hash-verified

1228 * @since 4.0
1229 */
1230 public interface IExitCodeExceptionMapper {
1231 /** Returns the exit code that should be returned from the {@link #execute(String...) execute} method.
1232 * @param exception the exception that occurred during parsing or while invoking the command's Runnable, Callable, or Method.
1233 * @return the exit code
1234 */
1235 int getExitCode(Throwable exception);
1236 }
1237 private static int mappedExitCode(Throwable t, IExitCodeExceptionMapper mapper, int defaultExitCode) {
1238 try {
1239 return (mapper != null) ? mapper.getExitCode(t) : defaultExitCode;

Callers

nothing calls this directly

Implementers 13

CustomExitCodeGeneratorpicocli-examples/src/main/java/picocli
ExitCodeExceptionMapperDemopicocli-examples/src/main/java/picocli
Appsrc/test/java/picocli/OptionMethodImpl
SubcommandTestssrc/test/java/picocli/SubcommandTests.
ExecuteTestsrc/test/java/picocli/ExecuteTest.java
ExitCodeGensrc/test/java/picocli/ExecuteTest.java
Cmdsrc/test/java/picocli/ArityTest.java
RepeatableSubcommandsTestsrc/test/java/picocli/RepeatableSubcom
MixinTestSubCommandsrc/test/java/picocli/RepeatableSubcom
CommandLineExecutionsrc/test/java/picocli/test/CommandLine
ProcessExecutionsrc/test/java/picocli/test/ProcessExec
Executionsrc/test/java/picocli/test/Execution.j

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…