com.phidgets
Class PhidgetException

java.lang.Object
  extended by java.lang.Throwable
      extended by java.lang.Exception
          extended by com.phidgets.PhidgetException
All Implemented Interfaces:
java.io.Serializable

public class PhidgetException
extends java.lang.Exception

This class represents Phidget related exceptions. All Phidget exceptions originate in the phidget21 C library. These exceptions can be thrown by most function in the library and cover such things as trying to access a Phidget before opening it, or before it is attached and ready to use, out of bounds Index and data values, and other less common problems.

See Also:
Serialized Form

Constructor Summary
PhidgetException(int errno, java.lang.String description)
          Constructor which takes is an error number and description.
 
Method Summary
 java.lang.String getDescription()
          Returns a description of this exception.
 int getErrorNumber()
          Returns the error number of this exception.
 java.lang.String toString()
          Returns a string containing the error number and exception description.
 
Methods inherited from class java.lang.Throwable
fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

PhidgetException

public PhidgetException(int errno,
                        java.lang.String description)
Constructor which takes is an error number and description. These exceptions originate from and are filled in by the phidget 21 C library.

Method Detail

getErrorNumber

public int getErrorNumber()
Returns the error number of this exception. This error number defines the type of Phidget error. These codes are defined in the base phidget21 C library as follows:

 EPHIDGET_OK                  0
 EPHIDGET_NOTFOUND            1
 EPHIDGET_NOMEMORY            2
 EPHIDGET_UNEXPECTED          3
 EPHIDGET_INVALIDARG          4
 EPHIDGET_NOTATTACHED         5
 EPHIDGET_INTERRUPTED         6
 EPHIDGET_INVALIDERROR        7
 EPHIDGET_NETWORKERROR        8
 EPHIDGET_UNKNOWNVAL          9
 EPHIDGET_BADPASSWORD         10
 EPHIDGET_UNSUPPORTEDERROR    11
 EPHIDGET_DUPLICATE           12
 EPHIDGET_TIMEOUT             13

Returns:
The error code

getDescription

public java.lang.String getDescription()
Returns a description of this exception. This is an english phrase that describes the exception that occured. These string originate in the base phidget21 C library, and should help to diagnose problems.

Returns:
The error description

toString

public java.lang.String toString()
Returns a string containing the error number and exception description.

Overrides:
toString in class java.lang.Throwable
Returns:
A string describing the error