mirror of
https://gitlab.com/MrFry/moodle-test-userscript
synced 2025-04-01 20:22:48 +02:00
Last info JSON parsing error handling
This commit is contained in:
parent
7dc12dbfa0
commit
6a638e0f78
1 changed files with 6 additions and 2 deletions
|
@ -21,7 +21,7 @@
|
||||||
|
|
||||||
// ==UserScript==
|
// ==UserScript==
|
||||||
// @name Moodle/Elearning/KMOOC test help
|
// @name Moodle/Elearning/KMOOC test help
|
||||||
// @version 2.0.1.1
|
// @version 2.0.1.2
|
||||||
// @description Online Moodle/Elearning/KMOOC test help
|
// @description Online Moodle/Elearning/KMOOC test help
|
||||||
// @author MrFry
|
// @author MrFry
|
||||||
// @match https://elearning.uni-obuda.hu/main/*
|
// @match https://elearning.uni-obuda.hu/main/*
|
||||||
|
@ -1716,7 +1716,11 @@
|
||||||
setVal('lastInfoCheckTime', now)
|
setVal('lastInfoCheckTime', now)
|
||||||
}
|
}
|
||||||
|
|
||||||
const lastInfo = JSON.parse(getVal('lastInfo'))
|
let lastInfo = { result: 'noLastInfo' }
|
||||||
|
try {
|
||||||
|
lastInfo = JSON.parse(getVal('lastInfo'))
|
||||||
|
} catch (e) {
|
||||||
|
}
|
||||||
if (lastInfo.result !== 'success' || now > lastCheck + (infoExpireTime * 1000)) {
|
if (lastInfo.result !== 'success' || now > lastCheck + (infoExpireTime * 1000)) {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
const url = apiAdress +
|
const url = apiAdress +
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue