Overview
This guides provides details about exception and error handling using RFID API3
Details
The Zebra RFID Android SDK throws two types of exceptions as a given
- InvalidUsageException
- OperationFailureException:
This exception is thrown when the user passes an invalid parameter, calling getInfo() gives detail error message
This exception is thrown when the requested operation is failed. The Exception contains the Operation RFIDResults, status description, time stamp & vendor specific message for the operation failure
Exception Handling
All API should be called under try-catch block to catch the exception thrown while performing API by SDK. Following example also shows how to get details about further error details and descriptions. OperationFailureException
has getVendorMessage()
and getResults()
methods. While InvalidUsageException
has getVendorMessage()
and getInfo()
methods
try {
reader.connect();
} catch (InvalidUsageException e) {
e.printStackTrace();
Log.d("DEMO", "InvalidUsageException=" + e.getVendorMessage() + " " + e.getInfo());
} catch (OperationFailureException e) {
e.printStackTrace();
Log.d("DEMO", "InvalidUsageException=" + e.getVendorMessage() + " " + e.getResults());
}