bcds.tools
Class ArgsParserException

java.lang.Object
  extended by java.lang.Throwable
      extended by java.lang.Exception
          extended by bcds.tools.ArgsParserException
All Implemented Interfaces:
java.io.Serializable

public class ArgsParserException
extends java.lang.Exception

Exception class for ArgsParser.

Author:
Juan Segovia S.
See Also:
Serialized Form

Nested Class Summary
static class ArgsParserException.ErrorCode
          Lists the error codes that ArgsParser can include in an ArgsParserException as an indication of the cause of the error.
 
Constructor Summary
ArgsParserException(ArgsParserException.ErrorCode err, java.lang.String msg)
          Creates an instance with the given error code and message.
ArgsParserException(ArgsParserException.ErrorCode err, java.lang.String fmt, java.lang.Object... message)
          Creates an instance with the given error code and formatted message.
 
Method Summary
 ArgsParserException.ErrorCode getErrorCode()
          Returns the error code associated to this exception.
 boolean isBadUsage()
          Returns true if this object can be considered an indicator of bad usage.
 java.lang.String toString()
          Returns the exception's message and the error code in parenthesis.
 
Methods inherited from class java.lang.Throwable
fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ArgsParserException

public ArgsParserException(ArgsParserException.ErrorCode err,
                           java.lang.String msg)
Creates an instance with the given error code and message.


ArgsParserException

public ArgsParserException(ArgsParserException.ErrorCode err,
                           java.lang.String fmt,
                           java.lang.Object... message)
Creates an instance with the given error code and formatted message.

Method Detail

toString

public java.lang.String toString()
Returns the exception's message and the error code in parenthesis.

Overrides:
toString in class java.lang.Throwable

getErrorCode

public ArgsParserException.ErrorCode getErrorCode()
Returns the error code associated to this exception.


isBadUsage

public boolean isBadUsage()
Returns true if this object can be considered an indicator of bad usage. This is so is the instance is one of the following: UNREGISTERED_OPTION, BAD_VALUE, BAD_ENUM, ARG_EXPECTED, NON_UNIQUE_OPTION, BAD_USAGE.

In this context, "bad usage" means when such an error occurs, typically the user needs help with usage (syntax, examples, etc.).