Skip to content

Commit 961bae6

Browse files
authored
[core] add try / catch on mode_helper loading (#3578)
When a library is missing on an 3rd party module, MM² stop loading and display a black screen. (I'm sure it's happened to everyone.) So, I have added a try/catch block and it's avoid black screen, display errors and allow continue loading with next module
1 parent f51fbe3 commit 961bae6

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ _This release is scheduled to be released on 2025-01-01._
2222
### Fixed
2323

2424
- [updatenotification] Fix pm2 using detection when pm2 script is in MagicMirror root folder (#3576)
25+
- [core] Fix loading node_helper of modules: avoid black screen, display errors and continue loading with next module (#3578)
2526

2627
## [2.29.0] - 2024-10-01
2728

js/app.js

+7-1
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,13 @@ function App () {
197197

198198
// if the helper was found
199199
if (loadHelper) {
200-
const Module = require(helperPath);
200+
let Module;
201+
try {
202+
Module = require(helperPath);
203+
} catch (e) {
204+
Log.error(`Error when loading ${moduleName}:`, e.message);
205+
return;
206+
}
201207
let m = new Module();
202208

203209
if (m.requiresVersion) {

0 commit comments

Comments
 (0)