Merge pull request #2150 from sdetweil/fixparse

add error handler to json parsing of translation files
This commit is contained in:
Michael Teeuw 2020-10-06 10:23:46 +02:00 committed by GitHub
commit ec80b25087
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 3 deletions

View File

@ -17,8 +17,9 @@ _This release is scheduled to be released on 2021-01-01._
### Fixed
- Calendar parsing where RRULE bug returns wrong date, add Windows timezone name support.
- Wrong node-ical version installed (package.json) requested version.
- JSON Parse translation files with comments crashing UI. (#2149)
- Calendar parsing where RRULE bug returns wrong date, add Windows timezone name support. (#2145, #2151)
- Wrong node-ical version installed (package.json) requested version. (#2153)
## [2.13.0] - 2020-10-01

View File

@ -19,7 +19,15 @@ var Translator = (function () {
xhr.open("GET", file, true);
xhr.onreadystatechange = function () {
if (xhr.readyState === 4 && xhr.status === 200) {
callback(JSON.parse(xhr.responseText));
// needs error handler try/catch at least
let fileinfo = null;
try {
fileinfo = JSON.parse(xhr.responseText);
} catch (exception) {
// nothing here, but don't die
Log.error(" loading json file =" + file + " failed");
}
callback(fileinfo);
}
};
xhr.send(null);