mirror of
https://github.com/MichMich/MagicMirror.git
synced 2025-06-30 13:09:34 +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
|
||||
|
||||
- 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
|
||||
|
||||
|
@ -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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user