[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
This commit is contained in:
Bugsounet - Cédric 2024-10-05 15:23:36 +02:00 committed by GitHub
parent f51fbe39c4
commit 961bae637c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 8 additions and 1 deletions

View File

@ -22,6 +22,7 @@ _This release is scheduled to be released on 2025-01-01._
### Fixed ### Fixed
- [updatenotification] Fix pm2 using detection when pm2 script is in MagicMirror root folder (#3576) - [updatenotification] Fix pm2 using detection when pm2 script is in MagicMirror root folder (#3576)
- [core] Fix loading node_helper of modules: avoid black screen, display errors and continue loading with next module (#3578)
## [2.29.0] - 2024-10-01 ## [2.29.0] - 2024-10-01

View File

@ -197,7 +197,13 @@ function App () {
// if the helper was found // if the helper was found
if (loadHelper) { if (loadHelper) {
const Module = require(helperPath); let Module;
try {
Module = require(helperPath);
} catch (e) {
Log.error(`Error when loading ${moduleName}:`, e.message);
return;
}
let m = new Module(); let m = new Module();
if (m.requiresVersion) { if (m.requiresVersion) {