Skip to content

Commit c963f3a

Browse files
committed
Just skip thumbnails that trigger errors. The next batch will probably be fine.
1 parent 68217ff commit c963f3a

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

utils/thumbnails.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -255,14 +255,14 @@ export const handler: Handler = async (event: any, context?: any) => {
255255
const max = meta2max.get(meta) || MAX;
256256
const random = randomInt(max, min);
257257
const realmove = Math.min(random, g.stack.length - 1);
258-
let json: any;
259258
try {
260259
g.load(realmove);
261-
json = g.render({});
260+
const json = g.render({});
261+
allRecs.set(meta, JSON.stringify(json));
262262
} catch (ex) {
263-
throw new Error(`An error occured when loading a specific move and trying to render it. ${JSON.stringify({meta, min, max, random, realmove, totalMoves: g.stack.length, sk: rec.sk})}`);
263+
console.log(`An error occured when loading a specific move and trying to render it. Skipping this thumbnail. ${JSON.stringify({meta, min, max, random, realmove, totalMoves: g.stack.length, sk: rec.sk})}`);
264+
continue;
264265
}
265-
allRecs.set(meta, JSON.stringify(json));
266266
}
267267
console.log(`Generated ${allRecs.size} thumbnails`);
268268

@@ -309,6 +309,6 @@ export const handler: Handler = async (event: any, context?: any) => {
309309
console.log("ALL DONE");
310310
})
311311
.catch(err => {
312-
throw new Error(`An error occurred while initializing i18next:\n${err}`);
312+
throw new Error(`An error occurred (final catch):\n${err}`);
313313
}));
314314
};

0 commit comments

Comments
 (0)