Exception handling
In ePOS-Print SDK for Android, it is designed that when an error occurs, a propriety exception with an integer
(int) type parameter is generated to notify the calling side of such an error. The ePOS-Print API acquires
information using the
EposException class
(p.40). The following errors are sent:
Type
Error status
Printer status
Steps for Handling
ePOS-Print API
Acquire the error status using
using
getPrinterStatus (p.94)
//<Send data for confirmation>
Print printer = new Print();
int[] status = new int[1];
status[0] = 0;
try {
//Create a print document
Builder builder = new Builder("TM-T88V", Builder.MODEL_ANK);
builder.addText("Hello,\t");
builder.addText("World!\n");
builder.addCut(Builder.CUT_FEED);
//<Send print data>
printer.openPrinter(Print.DEVTYPE_TCP, "192.168.192.168");
printer.sendData(builder, 10000, status);
printer.closePrinter();
} catch (EposException e) {
//Acquire the error status
int errStatus = e.getErrorStatus();
//Acquire the printer status
status[0] = e.getPrinterStatus();
printer.closePrinter();
}
34
EposException class
(p.40), and the search API acquires information using the
Cause of error when each class's API was executed.
For details, refer to
Status of the printer when print data was sent.
The printer status can be acquired only when
executed.
For details, refer to
getErrorStatus (p.93)
of that class. Use the programming example below for your reference.
Description
Error Status List
(p.36).
Printer Status List
(p.37).
of the EposException class, and acquire the printer status
sendData (p.91)
is