diff --git a/functions/src/publish.ts b/functions/src/publish.ts index 92b090d..7e89934 100644 --- a/functions/src/publish.ts +++ b/functions/src/publish.ts @@ -114,6 +114,7 @@ async function getRawEntries(): Promise { const entries: T.DictionaryEntry[] = []; // let sheetIndex = 0; // get the rows in order of ts for easy detection of duplicate entries + const duplicates: Set = new Set(); for (let i = 0; i < rows.length; i++) { // function sameEntry(a: any, b: any): boolean { // return a.p === b.p && a.f === b.f && a.e === b.e; @@ -129,9 +130,16 @@ async function getRawEntries(): Promise { // sheetIndex--; // continue; // } else { - throw new Error(`ts ${row.ts} is a duplicate ts of a different entry`); + duplicates.add(row.ts); // } } + if (duplicates.size) { + throw new Error( + `ts ${Array.from(duplicates).join( + ", " + )} is a duplicate ts of a different entry` + ); + } const e: T.DictionaryEntry = { i: 1, ts: parseInt(row.ts),