-
Notifications
You must be signed in to change notification settings - Fork 18
Expand file tree
/
Copy pathDocoptExitException.java
More file actions
40 lines (32 loc) · 937 Bytes
/
DocoptExitException.java
File metadata and controls
40 lines (32 loc) · 937 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
package org.docopt;
/**
* An exception thrown by {@link Docopt#parse} to indicate that the application
* should exit. This could be normal (e.g. default {@code --help} behavior) or
* abnormal (e.g. incorrect arguments).
*/
public final class DocoptExitException extends RuntimeException {
private static final long serialVersionUID = 1L;
private final int exitCode;
private final boolean printUsage;
DocoptExitException(final int exitCode, final String message,
final boolean printUsage) {
super(message);
this.exitCode = exitCode;
this.printUsage = printUsage;
}
DocoptExitException(final int exitCode) {
this(exitCode, null, false);
}
/**
* Returns a numeric code indicating the cause of the exit. By convention, a
* non-zero code indicates abnormal termination.
*
* @return the exit code
*/
public int getExitCode() {
return exitCode;
}
boolean getPrintUsage() {
return printUsage;
}
}