Skip to content

systeminformation thread not ending: move error handling from utils to app#4160

Open
khassel wants to merge 1 commit into
MagicMirrorOrg:developfrom
khassel:sysinfo
Open

systeminformation thread not ending: move error handling from utils to app#4160
khassel wants to merge 1 commit into
MagicMirrorOrg:developfrom
khassel:sysinfo

Conversation

@khassel
Copy link
Copy Markdown
Collaborator

@khassel khassel commented May 18, 2026

This reverts #4155 because that didn't work when running under electron (process.on("exit",...) is not called).

This approach puts a try/catch around the start function in app.js and in utils.js the process.exit(1) calls are replaced with throw new Error("process.exit:1");. The error message process.exit:1 is not evaluated in app.js but needed in the tests.

The short delay is now implemented in the catch block so the systeminformation is displayed.

Copy link
Copy Markdown
Collaborator

@KristjanESPERANTO KristjanESPERANTO left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! One additional thought: would it make sense to introduce a small dedicated error class (e.g. ConfigError) instead of matching on the "process.exit:1" message string? That might make the intent a bit clearer. No strong opinion though - could also just as well be a follow-up PR.

Comment thread js/app.js
return global.config;
return global.config;
} catch {
const int32 = new Int32Array(new SharedArrayBuffer(4));
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about adding a log line here, so unexpected errors don't get swallowed silently? Something like:

Suggested change
const int32 = new Int32Array(new SharedArrayBuffer(4));
// planned config exits already logged their message before throwing
if (error?.message !== "process.exit:1") {
Log.error("Unexpected error during startup:", error);
}
const int32 = new Int32Array(new SharedArrayBuffer(4));

Otherwise anything else that throws in start() (a broken require, httpServer.open() failing, …) just turns into exit(1) without a stack.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants