Skip to content

Commit 25d1f39

Browse files
committed
Catch and log more errors
1 parent 3794a57 commit 25d1f39

File tree

2 files changed

+32
-16
lines changed

2 files changed

+32
-16
lines changed

wallpanel-src.js

Lines changed: 31 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* Released under the GNU General Public License v3.0
44
*/
55

6-
const version = "4.56.0";
6+
const version = "4.56.1";
77
const defaultConfig = {
88
enabled: false,
99
enabled_on_views: [],
@@ -762,10 +762,10 @@ function updateConfig() {
762762
}
763763

764764
function getActiveBrowserModPopups() {
765+
const popups = [];
765766
if (!browserId) {
766-
return null;
767+
return popups;
767768
}
768-
const popups = [];
769769
elHass.shadowRoot.querySelectorAll(".browser_mod-card_mod").forEach((popup) => {
770770
if (popup.shadowRoot && popup.shadowRoot.children.length > 0) {
771771
popups.push(popup);
@@ -2043,25 +2043,37 @@ function initWallpanel() {
20432043
window.addEventListener(
20442044
eventName,
20452045
(event) => {
2046-
wp.handleInteractionEvent(event);
2046+
try {
2047+
wp.handleInteractionEvent(event);
2048+
} catch (error) {
2049+
logger.error(error.stack);
2050+
}
20472051
},
20482052
{ capture: true }
20492053
);
20502054
});
20512055
window.addEventListener("resize", () => {
2052-
const width = this.screensaverContainer.clientWidth;
2053-
const height = this.screensaverContainer.clientHeight;
2054-
if (wp.screensaverRunning() && (wp.currentWidth != width || wp.currentHeight != height)) {
2055-
logger.debug(`Size changed from ${wp.currentWidth}x${wp.currentHeight} to ${width}x${height}`);
2056-
wp.currentWidth = width;
2057-
wp.currentHeight = height;
2058-
wp.updateShadowStyle();
2059-
wp.setMediaDimensions();
2056+
try {
2057+
const width = this.screensaverContainer.clientWidth;
2058+
const height = this.screensaverContainer.clientHeight;
2059+
if (wp.screensaverRunning() && (wp.currentWidth != width || wp.currentHeight != height)) {
2060+
logger.debug(`Size changed from ${wp.currentWidth}x${wp.currentHeight} to ${width}x${height}`);
2061+
wp.currentWidth = width;
2062+
wp.currentHeight = height;
2063+
wp.updateShadowStyle();
2064+
wp.setMediaDimensions();
2065+
}
2066+
} catch (error) {
2067+
logger.error(error.stack);
20602068
}
20612069
});
20622070
window.addEventListener("hass-more-info", () => {
2063-
if (wp.screensaverRunning()) {
2064-
wp.moreInfoDialogToForeground();
2071+
try {
2072+
if (wp.screensaverRunning()) {
2073+
wp.moreInfoDialogToForeground();
2074+
}
2075+
} catch (error) {
2076+
logger.error(error.stack);
20652077
}
20662078
});
20672079
const infoBoxResizeObserver = new ResizeObserver(() => {
@@ -4046,7 +4058,11 @@ function startup() {
40464058
}
40474059

40484060
console.info(`%c🖼️ Wallpanel version ${version}`, "color: #34b6f9; font-weight: bold;");
4049-
waitForEnv(startup);
4061+
try {
4062+
waitForEnv(startup);
4063+
} catch (error) {
4064+
logger.error(error.stack);
4065+
}
40504066

40514067
/**
40524068
* https://github.com/exif-js/exif-js

wallpanel.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)