ESCPOS-ThermalPrinter-Android
ESCPOS-ThermalPrinter-Android copied to clipboard
catch errors
Hi, thanks for your job !
How is the best way to catch errors when you do this ?
EscPosPrinter printer = new EscPosPrinter(BluetoothPrintersConnections.selectFirstPaired(), 203, 48f, 32);
DeviceConnection printerConnection = BluetoothPrintersConnections.selectFirstPaired();
if(printerConnection == null) {
// No printer is connected...
} else {
try {
EscPosPrinter printer = new EscPosPrinter(printerConnection, 203, 48f, 32);
} catch (EscPosConnectionException e) {
// Printer is disconnected...
e.printStackTrace();
}
}