miSim

misim
Class MiSimException

java.lang.Object
  |
  +--java.lang.Throwable
        |
        +--java.lang.Exception
              |
              +--misim.MiSimException
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
EditorException

public class MiSimException
extends java.lang.Exception

The MiSimException class is used throughout miSim to indicate error conditions or report particular events. Essentially, it acts as a combined wrapper for the standard Java Exception class and for the miSim.util.Txt class, which provides internationalisation and message display.

The errorType set for a MiSimException is the same as a Txt message ID, except that it must fall within the range of IDs assigned to exception messages. These are identified in the message file by the two exceptions 'EX_FIRST_EXCEPTION' and 'EX_LAST_EXCEPTION'.

See Also:
Serialized Form

Field Summary
protected  java.lang.String[] errorText
           
protected  int errorType
           
 
Constructor Summary
MiSimException(int errorType)
          Create a new MiSimException with the given error type.
MiSimException(int errorType, int value)
          Create a new MiSimException with the given error type, and the given integer parameter.
MiSimException(int errorType, java.lang.String value)
          Create a new MiSimException with the given error type, and the given String parameter.
MiSimException(int errorType, java.lang.String[] values)
          Create a new MiSimException with the given error type, and the given String parameters.
 
Method Summary
protected  java.lang.String exceptionString(boolean showId)
          Generic method to return the error message in different formats, so that subclasses of misimException can implement different toString() behaviour.
 int getType()
          Return the error type for this exception
 java.lang.String[] getValues()
          Return the array of string values for this exception
 java.lang.String toString()
          Return a String that describes the MiSimException.
 
Methods inherited from class java.lang.Throwable
fillInStackTrace, getLocalizedMessage, getMessage, printStackTrace, printStackTrace, printStackTrace
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

errorType

protected int errorType

errorText

protected java.lang.String[] errorText
Constructor Detail

MiSimException

public MiSimException(int errorType)
Create a new MiSimException with the given error type.
Parameters:
errorType - The message ID for this exception

MiSimException

public MiSimException(int errorType,
                      int value)
Create a new MiSimException with the given error type, and the given integer parameter. This will be inserted into the Exception message when toString() is called for this exception.
Parameters:
errorType - The message ID for this exception
value - An integer value relevant to this exception

MiSimException

public MiSimException(int errorType,
                      java.lang.String value)
Create a new MiSimException with the given error type, and the given String parameter. This will be inserted into the Exception message when toString() is called for this exception.
Parameters:
errorType - The message ID for this exception
value - An String value relevant to this exception

MiSimException

public MiSimException(int errorType,
                      java.lang.String[] values)
Create a new MiSimException with the given error type, and the given String parameters. These will be inserted into the Exception message when toString() is called for this exception.
Parameters:
errorType - The message ID for this exception
value - An array of String values relevant to this exception
Method Detail

getType

public int getType()
Return the error type for this exception
Returns:
the error type

getValues

public java.lang.String[] getValues()
Return the array of string values for this exception
Returns:
An array of strings

toString

public java.lang.String toString()
Return a String that describes the MiSimException. The String is generated from the miSim Txt message class, using the errorType as the message ID, and any additional parameters passed when the MiSimException was created as parameters to be substituted into the message by the Txt class.
Overrides:
toString in class java.lang.Throwable
Returns:
A String describing this exception

exceptionString

protected java.lang.String exceptionString(boolean showId)
Generic method to return the error message in different formats, so that subclasses of misimException can implement different toString() behaviour.
Parameters:
showId - If true, append the error ID to the string
Returns:
The text for this exception

miSim