Added BRC_NO_POOL error

This commit is contained in:
Alexander Cerutti
2019-06-30 02:02:24 +02:00
parent 25aa60ba99
commit c61921721e
2 changed files with 6 additions and 0 deletions

View File

@@ -25,6 +25,7 @@ const debugMessages: MessageGroup = {
BRC_FORMATTYPE_UNMATCH: "Format must be a string or null. Cannot set backward compatibility.",
BRC_AUTC_MISSING_DATA: "Unable to autogenerate barcodes. Data is not a string.",
BRC_BW_FORMAT_UNSUPPORTED: "This format is not supported (by Apple) for backward support. Please choose another one.",
BRC_NO_POOL: "Cannot set barcode: no barcodes found. Please set barcodes first. Barcode is for retrocompatibility only.",
DATE_FORMAT_UNMATCH: "%s was not set due to incorrect date format."
};

View File

@@ -415,6 +415,11 @@ export class Pass implements PassIndexSignature {
return this;
}
if (!(barcodes && barcodes.length)) {
barcodeDebug(formatMessage("BRC_NO_POOL"))
return this;
}
// Checking which object among barcodes has the same format of the specified one.
const index = barcodes.findIndex(b => b.format.toLowerCase().includes(chosenFormat.toLowerCase()));