Class DeviceException

All Implemented Interfaces:
Serializable

public class DeviceException extends IOException
DeviceException is a special IOException, which is thrown to indicate that there is a device operation fail. The error reason can be located with getCode() method. The cause is available with Throwable.getCause().
See Also:
  • Field Details

    • UNKNOWN

      public static final int UNKNOWN
      An exception code indicates that the error is unknown.
      See Also:
    • COMMUNICATION_ERROR

      public static final int COMMUNICATION_ERROR
      An exception code indicates that there is an error in the communication.
      See Also:
    • TIMEOUT

      public static final int TIMEOUT
      An exception code indicates that there is expired timeout without any processing.
      See Also:
    • NOT_INITIALIZED

      public static final int NOT_INITIALIZED
      An exception code indicates that the device is not initialized. The device status is Device.STATUS_NOT_INITIALIZED or Device.STATUS_PROCESSING.
      See Also:
    • NO_DATA

      public static final int NO_DATA
      An exception code indicates that the requested value is currently not available.
      See Also:
  • Constructor Details

    • DeviceException

      public DeviceException()
      Construct a new device exception with null message. The cause is not initialized and the exception code is set to UNKNOWN.
    • DeviceException

      public DeviceException(String message)
      Constructs a new device exception with the given message. The cause is not initialized and the exception code is set to UNKNOWN.
      Parameters:
      message - The exception message.
    • DeviceException

      public DeviceException(String message, Throwable cause)
      Constructs a new device exception with the given message and cause. The exception code is set to UNKNOWN.
      Parameters:
      message - The exception message.
      cause - The exception cause.
    • DeviceException

      public DeviceException(String message, Throwable cause, int code)
      Constructs a new device exception with the given message, cause and code.
      Parameters:
      message - The exception message.
      cause - The exception cause.
      code - The exception code.
  • Method Details

    • getCode

      public int getCode()
      Returns the exception code. It indicates the reason for this exception. The code can be: Zero and positive values are reserved for this definition and further extensions of the device exception codes. Custom codes can be used only as negative values to prevent potential collisions.
      Returns:
      An exception code.