mirror of
https://github.com/MichMich/MagicMirror.git
synced 2025-07-01 05:23:25 +00:00
Merge pull request #2150 from sdetweil/fixparse
add error handler to json parsing of translation files
This commit is contained in:
commit
ec80b25087
@ -17,8 +17,9 @@ _This release is scheduled to be released on 2021-01-01._
|
|||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|
||||||
- Calendar parsing where RRULE bug returns wrong date, add Windows timezone name support.
|
- JSON Parse translation files with comments crashing UI. (#2149)
|
||||||
- Wrong node-ical version installed (package.json) requested version.
|
- 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
|
## [2.13.0] - 2020-10-01
|
||||||
|
|
||||||
|
@ -19,7 +19,15 @@ var Translator = (function () {
|
|||||||
xhr.open("GET", file, true);
|
xhr.open("GET", file, true);
|
||||||
xhr.onreadystatechange = function () {
|
xhr.onreadystatechange = function () {
|
||||||
if (xhr.readyState === 4 && xhr.status === 200) {
|
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);
|
xhr.send(null);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user