Package org.osgi.service.dal
Class DeviceException
java.lang.Object
java.lang.Throwable
java.lang.Exception
java.io.IOException
org.osgi.service.dal.DeviceException
- All Implemented Interfaces:
Serializable
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 Summary
Modifier and TypeFieldDescriptionstatic final int
An exception code indicates that there is an error in the communication.static final int
An exception code indicates that the requested value is currently not available.static final int
An exception code indicates that the device is not initialized.static final int
An exception code indicates that there is expired timeout without any processing.static final int
An exception code indicates that the error is unknown. -
Constructor Summary
ConstructorDescriptionConstruct a new device exception withnull
message.DeviceException
(String message) Constructs a new device exception with the given message.DeviceException
(String message, Throwable cause) Constructs a new device exception with the given message and cause.DeviceException
(String message, Throwable cause, int code) Constructs a new device exception with the given message, cause and code. -
Method Summary
Methods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
Field Details
-
UNKNOWN
public static final int UNKNOWNAn exception code indicates that the error is unknown.- See Also:
-
COMMUNICATION_ERROR
public static final int COMMUNICATION_ERRORAn exception code indicates that there is an error in the communication.- See Also:
-
TIMEOUT
public static final int TIMEOUTAn exception code indicates that there is expired timeout without any processing.- See Also:
-
NOT_INITIALIZED
public static final int NOT_INITIALIZEDAn exception code indicates that the device is not initialized. The device status isDevice.STATUS_NOT_INITIALIZED
orDevice.STATUS_PROCESSING
.- See Also:
-
NO_DATA
public static final int NO_DATAAn exception code indicates that the requested value is currently not available.- See Also:
-
-
Constructor Details
-
DeviceException
public DeviceException()Construct a new device exception withnull
message. The cause is not initialized and the exception code is set toUNKNOWN
. -
DeviceException
Constructs a new device exception with the given message. The cause is not initialized and the exception code is set toUNKNOWN
.- Parameters:
message
- The exception message.
-
DeviceException
Constructs a new device exception with the given message and cause. The exception code is set toUNKNOWN
.- Parameters:
message
- The exception message.cause
- The exception cause.
-
DeviceException
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:UNKNOWN
COMMUNICATION_ERROR
TIMEOUT
NOT_INITIALIZED
NO_DATA
- custom code
- Returns:
- An exception code.
-