Package pro.johndunlap.getopt.exception
Class ParseException
- java.lang.Object
-
- java.lang.Throwable
-
- java.lang.Exception
-
- pro.johndunlap.getopt.exception.ParseException
-
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
DuplicateOptionException,InaccessibleFieldException,MissingNoArgConstructorException,RethrownException,UnsupportedTypeConversionException
public class ParseException extends Exception
Thrown when a value cannot be parsed.- Author:
- John Dunlap
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static intDEFAULT_ERROR_EXIT_STATUS
-
Constructor Summary
Constructors Constructor Description ParseException(Field field, String message)ParseException(Field field, String value, String message)Constructs a new exception with the specified field, value, and message.ParseException(String message)ParseException(String value, String message)ParseException(String message, Throwable cause)ParseException(Throwable cause)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intgetExitStatus()Returns the exit status which should be passed back to the shell for this exception.FieldgetField()StringgetValue()-
Methods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
-
-
-
Field Detail
-
DEFAULT_ERROR_EXIT_STATUS
public static final int DEFAULT_ERROR_EXIT_STATUS
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
ParseException
public ParseException(Field field, String value, String message)
Constructs a new exception with the specified field, value, and message.- Parameters:
field- The field which could not be populatedvalue- The value that could not be parsedmessage- The message to include in the exception
-
ParseException
public ParseException(String message)
-
ParseException
public ParseException(Throwable cause)
-
-
Method Detail
-
getExitStatus
public int getExitStatus()
Returns the exit status which should be passed back to the shell for this exception. Allowing this to be different on a field by field basis can allow shell programs to determine which fields were invalid.- Returns:
- The exit status which should be passed back to the shell
-
getField
public Field getField()
-
getValue
public String getValue()
-
-