Handle an odd intermittent issue and import recent changes from the wiki

This commit is contained in:
mtkennerly 2020-08-14 20:09:02 -04:00
parent a2a34c9fb3
commit 0cdbad886b
4 changed files with 10 additions and 6 deletions

View file

@ -504,6 +504,10 @@ export async function getGame(pageTitle: string, cache: WikiGameCache): Promise<
client.api, "call", params
);
const newTitle = data.pages[pageId.toString()].title;
if (newTitle === undefined) {
// This happened once intermittently; the cause is unclear.
throw new Error("Unable to retrieve page by ID");
}
console.log(`:: getGame: page ${pageId} called '${pageTitle}' renamed to '${newTitle}'`);
cache[newTitle] = cache[pageTitle];
delete cache[pageTitle];