react-native-thermal-pos-printer
Version:
React Native thermal printer package for POS systems supporting Xprinter and other popular brands
40 lines (39 loc) • 1.78 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.PrinterErrorCode = exports.PrinterError = void 0;
let PrinterErrorCode = exports.PrinterErrorCode = /*#__PURE__*/function (PrinterErrorCode) {
PrinterErrorCode["CONNECTION_FAILED"] = "CONNECTION_FAILED";
PrinterErrorCode["DEVICE_NOT_FOUND"] = "DEVICE_NOT_FOUND";
PrinterErrorCode["PRINT_FAILED"] = "PRINT_FAILED";
PrinterErrorCode["DEVICE_NOT_CONNECTED"] = "DEVICE_NOT_CONNECTED";
PrinterErrorCode["INVALID_PARAMETER"] = "INVALID_PARAMETER";
PrinterErrorCode["TIMEOUT"] = "TIMEOUT";
PrinterErrorCode["PERMISSION_DENIED"] = "PERMISSION_DENIED";
PrinterErrorCode["HARDWARE_ERROR"] = "HARDWARE_ERROR";
PrinterErrorCode["INIT_FAILED"] = "INIT_FAILED";
PrinterErrorCode["DEVICE_LIST_FAILED"] = "DEVICE_LIST_FAILED";
PrinterErrorCode["DISCONNECTION_FAILED"] = "DISCONNECTION_FAILED";
PrinterErrorCode["INVALID_TEXT"] = "INVALID_TEXT";
PrinterErrorCode["STATUS_CHECK_FAILED"] = "STATUS_CHECK_FAILED";
PrinterErrorCode["NOT_CONNECTED"] = "NOT_CONNECTED";
PrinterErrorCode["PRINT_SUCCESS"] = "PRINT_SUCCESS";
PrinterErrorCode["BLUETOOTH_NOT_SUPPORTED"] = "BLUETOOTH_NOT_SUPPORTED";
PrinterErrorCode["BLUETOOTH_NOT_ENABLED"] = "BLUETOOTH_NOT_ENABLED";
PrinterErrorCode["INVALID_IMAGE"] = "INVALID_IMAGE";
return PrinterErrorCode;
}({});
class PrinterError extends Error {
constructor(code, message, nativeError) {
super(message);
this.name = 'PrinterError';
this.code = code;
this.nativeError = nativeError;
}
static fromNativeError(nativeError) {
return new PrinterError(PrinterErrorCode.HARDWARE_ERROR, nativeError.message || 'Unknown error', nativeError);
}
}
exports.PrinterError = PrinterError;
//# sourceMappingURL=errors.js.map