mirror of
https://github.com/MichMich/MagicMirror.git
synced 2025-08-21 04:45:17 +00:00
Update error handling for newsfeed and calendar
This commit is contained in:
@@ -147,10 +147,11 @@ Module.register("calendar", {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (notification === "FETCH_ERROR") {
|
} else if (notification === "FETCH_ERROR") {
|
||||||
Log.error("Calendar Error. Could not fetch calendar: " + payload.url);
|
this.error = this.translate("MODULE_CONFIG_ERROR", { MODULE_NAME: this.name, ERROR: payload.error });
|
||||||
this.loaded = true;
|
this.loaded = true;
|
||||||
} else if (notification === "INCORRECT_URL") {
|
} else if (notification === "INCORRECT_URL") {
|
||||||
Log.error("Calendar Error. Incorrect url: " + payload.url);
|
this.error = `Incorrect url: ${payload.url}`;
|
||||||
|
this.loaded = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.updateDom(this.config.animationSpeed);
|
this.updateDom(this.config.animationSpeed);
|
||||||
@@ -168,6 +169,12 @@ Module.register("calendar", {
|
|||||||
const wrapper = document.createElement("table");
|
const wrapper = document.createElement("table");
|
||||||
wrapper.className = this.config.tableClass;
|
wrapper.className = this.config.tableClass;
|
||||||
|
|
||||||
|
if (this.error) {
|
||||||
|
wrapper.innerHTML = this.error;
|
||||||
|
wrapper.className = this.config.tableClass + " dimmed";
|
||||||
|
return wrapper;
|
||||||
|
}
|
||||||
|
|
||||||
if (events.length === 0) {
|
if (events.length === 0) {
|
||||||
wrapper.innerHTML = this.loaded ? this.translate("EMPTY") : this.translate("LOADING");
|
wrapper.innerHTML = this.loaded ? this.translate("EMPTY") : this.translate("LOADING");
|
||||||
wrapper.className = this.config.tableClass + " dimmed";
|
wrapper.className = this.config.tableClass + " dimmed";
|
||||||
|
@@ -89,6 +89,9 @@ Module.register("newsfeed", {
|
|||||||
|
|
||||||
this.loaded = true;
|
this.loaded = true;
|
||||||
this.error = null;
|
this.error = null;
|
||||||
|
} else if (notification === "FETCH_ERROR") {
|
||||||
|
this.error = `Could not fetch newsfeed ${payload.url}`;
|
||||||
|
this.scheduleUpdateInterval();
|
||||||
} else if (notification === "INCORRECT_URL") {
|
} else if (notification === "INCORRECT_URL") {
|
||||||
this.error = `Incorrect url: ${payload.url}`;
|
this.error = `Incorrect url: ${payload.url}`;
|
||||||
this.scheduleUpdateInterval();
|
this.scheduleUpdateInterval();
|
||||||
|
@@ -52,6 +52,7 @@ module.exports = NodeHelper.create({
|
|||||||
});
|
});
|
||||||
|
|
||||||
fetcher.onError((fetcher, error) => {
|
fetcher.onError((fetcher, error) => {
|
||||||
|
Log.error("Newsfeed Error. Could not fetch newsfeed: ", fetcher.url(), error);
|
||||||
this.sendSocketNotification("FETCH_ERROR", {
|
this.sendSocketNotification("FETCH_ERROR", {
|
||||||
url: fetcher.url(),
|
url: fetcher.url(),
|
||||||
error: error
|
error: error
|
||||||
|
Reference in New Issue
Block a user