From 8e5526519f83b6723078b8bacd42d00ef3aa6987 Mon Sep 17 00:00:00 2001 From: Ross Date: Tue, 2 Mar 2021 23:36:16 +0000 Subject: [PATCH] single retry when downloading aquestion --- js/main.js | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/js/main.js b/js/main.js index f64e988..018b2ce 100644 --- a/js/main.js +++ b/js/main.js @@ -459,11 +459,28 @@ function setUpPacket(data, path) { console.log("Creating ", question_url, question_number, question_total); //$("#progress").html(`Downloading [${question_number}/${question_total}]`); - const question_json = await interact.getQuestion( + let question_json = {} + try { + question_json = await interact.getQuestion( question_url, question_number, question_total - ); + ).fail(( jqXHR, textStatus, errorThrown ) => { + console.log(jqXHR, textStatus, errorThrown); + console.log("error loading question"); + data["questions"][n] = {}; + }); + } catch (error) { + console.log(error); + console.log("error loading question ", question_url); + + question_json = await interact.getQuestion( + question_url, + question_number, + question_total + ) + + } if (question_json.hasOwnProperty("cached") && question_json["cached"]) { console.log("loading cached packet")}