mirror of
https://git.quad4.io/RNS-Things/MeshChatX.git
synced 2026-04-27 10:45:44 +00:00
feat(electron): update logging for renderer process events; add detailed crash and unresponsive handling
This commit is contained in:
@@ -401,6 +401,20 @@ function log(message) {
|
||||
mainWindow.webContents.send("log", message);
|
||||
}
|
||||
|
||||
function formatRenderProcessGoneDetails(details) {
|
||||
if (!details) {
|
||||
return "no details";
|
||||
}
|
||||
return JSON.stringify(
|
||||
{
|
||||
reason: details.reason || "unknown",
|
||||
exitCode: details.exitCode,
|
||||
},
|
||||
null,
|
||||
2,
|
||||
);
|
||||
}
|
||||
|
||||
function getDefaultStorageDir() {
|
||||
// if we are running a windows portable exe, we want to use .reticulum-meshchat in the portable exe dir
|
||||
// e.g if we launch "E:\Some\Path\MeshChat.exe" we want to use "E:\Some\Path\.reticulum-meshchat"
|
||||
@@ -526,6 +540,12 @@ app.whenReady().then(async () => {
|
||||
enableRemoteModule: false,
|
||||
},
|
||||
});
|
||||
mainWindow.webContents.on("render-process-gone", (_event, details) => {
|
||||
log(`Renderer process crashed: ${formatRenderProcessGoneDetails(details)}`);
|
||||
});
|
||||
mainWindow.webContents.on("unresponsive", () => {
|
||||
log("Renderer process became unresponsive.");
|
||||
});
|
||||
|
||||
// minimize to tray behavior
|
||||
mainWindow.on("close", (event) => {
|
||||
@@ -751,6 +771,11 @@ app.whenReady().then(async () => {
|
||||
}
|
||||
});
|
||||
|
||||
app.on("render-process-gone", (_event, webContents, details) => {
|
||||
const wcId = webContents ? webContents.id : "unknown";
|
||||
log(`render-process-gone for webContents ${wcId}: ${formatRenderProcessGoneDetails(details)}`);
|
||||
});
|
||||
|
||||
function quit() {
|
||||
if (!exeChildProcess) {
|
||||
app.quit();
|
||||
|
||||
Reference in New Issue
Block a user