Skip to content

Commit a329c8e

Browse files
committed
Unify error message handling and set alert_errors default to true
1 parent eaeded9 commit a329c8e

File tree

3 files changed

+11
-19
lines changed

3 files changed

+11
-19
lines changed

docs/configuration.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ You can set the following configuration parameters for every individual Home Ass
88
| debug | Enable debug mode? | false |
99
| wait_for_browser_mod_time | How long to wait for browser_mod to be available (in seconds)? This config attribute can only be set in the main configuration and not in profiles, user-specific or device-specific. | 0.25 |
1010
| log_level_console | Log level to use for logging to the browser console (error / warn / info / debug). | info |
11-
| alert_errors | Display error messages in an alert box. | false |
11+
| alert_errors | Display error messages in an alert box. | true |
1212
| hide_toolbar | Hide the upper panel toolbar? Please see [FAQ](faq.md#dashboard-cannot-be-edited) how to edit your dashboard when toolbar is hidden. | false |
1313
| hide_toolbar_on_subviews | Hide the toolbar in subviews too? | false |
1414
| keep_toolbar_space | If the toolbar is hidden, should the space where the toolbar is normally located remain empty? | false |

wallpanel-src.js

Lines changed: 9 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ const defaultConfig = {
1010
debug: false,
1111
wait_for_browser_mod_time: 0.25,
1212
log_level_console: "info",
13-
alert_errors: false,
13+
alert_errors: true,
1414
hide_toolbar: false,
1515
keep_toolbar_space: false,
1616
hide_toolbar_action_icons: false,
@@ -371,7 +371,7 @@ class ScreenWakeLock {
371371
.catch((e) => {
372372
this.enabled = false;
373373
this.error = e;
374-
logger.error(`Failed to request screen wakeLock: ${e}`);
374+
logger.warning(`Failed to request screen wakeLock: ${e}`);
375375
});
376376
} else {
377377
logger.debug("Starting video player");
@@ -389,7 +389,7 @@ class ScreenWakeLock {
389389
.catch((error) => {
390390
this.enabled = false;
391391
this.error = error;
392-
logger.error(`Failed to play video: ${error}`);
392+
logger.warning(`Failed to play video: ${error}`);
393393
});
394394
}
395395
}
@@ -2348,7 +2348,6 @@ function initWallpanel() {
23482348
} else {
23492349
const errorMsg = `Failed to update media list from ${config.image_url} after ${maxRetries} retries: ${error.message || stringify(error)}`;
23502350
logger.error(errorMsg);
2351-
wp.showMessage("error", "Error", errorMsg, 10000);
23522351
}
23532352
}
23542353
this.updatingMediaList = false;
@@ -2579,8 +2578,7 @@ function initWallpanel() {
25792578
function finalizeImageList() {
25802579
if (urls.length == 0) {
25812580
const msg = "No matching media assets found";
2582-
console.warn(msg);
2583-
wp.showMessage("warning", "Warning", msg);
2581+
logger.error(msg);
25842582
}
25852583
if (config.media_order == "random") {
25862584
urls = shuffleArray(urls);
@@ -2640,8 +2638,7 @@ function initWallpanel() {
26402638
if (!searchResults.assets.count) {
26412639
if (page == 1) {
26422640
const msg = `No media items found in immich that contain all these people: ${personNames}`;
2643-
logger.warn(msg);
2644-
wp.showMessage("warning", "Warning", msg);
2641+
logger.error(msg);
26452642
}
26462643
break;
26472644
}
@@ -2694,8 +2691,7 @@ function initWallpanel() {
26942691
if (!searchResults.assets.count) {
26952692
if (page == 1) {
26962693
const msg = `No media items found in immich that contain these tags: ${tagNamesLower}`;
2697-
logger.warn(msg);
2698-
wp.showMessage("warning", "Warning", msg);
2694+
logger.error(msg);
26992695
}
27002696
break;
27012697
}
@@ -2707,8 +2703,7 @@ function initWallpanel() {
27072703
}
27082704
} else {
27092705
const msg = "No matching immich tags found or selected.";
2710-
logger.warn(msg);
2711-
wp.showMessage("warning", "Warning", msg);
2706+
logger.error(msg);
27122707
}
27132708
} else {
27142709
// Default: Fetch albums
@@ -2737,8 +2732,7 @@ function initWallpanel() {
27372732
});
27382733
} else {
27392734
const msg = "No matching immich albums found or selected.";
2740-
logger.warn(msg);
2741-
wp.showMessage("warning", "Warning", msg);
2735+
logger.error(msg);
27422736
}
27432737
}
27442738

@@ -3066,7 +3060,6 @@ function initWallpanel() {
30663060
// Make sure the "Keep WiFi on during sleep" option is enabled.
30673061
// Set your WiFi connection to "not metered".
30683062
logger.error(`Failed to update media from ${element.mediaUrl}:`, error);
3069-
this.showMessage("error", "Error", `Failed to update media from ${element.mediaUrl}: ${error}`, 5000);
30703063
}
30713064
this.updatingMedia = false;
30723065
return element;
@@ -3199,7 +3192,6 @@ function initWallpanel() {
31993192
cleanupListeners();
32003193
if (activeElem === this.getActiveMediaElement()) {
32013194
logger.error(`Failed to play media "${activeElem.mediaUrl}" (src=${videoElement.src}):`, e);
3202-
wp.showMessage("error", "Error", `Failed to play media "${activeElem.mediaUrl}": ${e}`);
32033195
}
32043196
});
32053197
}
@@ -3391,7 +3383,7 @@ function initWallpanel() {
33913383
const wp = this;
33923384
setTimeout(function () {
33933385
if (wp.screensaverRunning() && !wp.screenWakeLock.enabled) {
3394-
logger.error(
3386+
logger.warning(
33953387
"Keep screen on will not work because the user didn't interact with the document first. https://goo.gl/xX8pDD"
33963388
);
33973389
wp.showMessage(

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)