Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions runtime/src/js/pgadmin.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,16 @@ if (!gotTheLock) {
});
}

// A crashed renderer or GPU process leaves a window blank with nothing in
// the log to say why, so record it.
app.on('render-process-gone', (_e, contents, details) => {
const url = contents.isDestroyed() ? '' : ` for ${contents.getURL()}`;
misc.writeServerLog(`Renderer process gone${url}: reason=${details.reason}, exitCode=${details.exitCode}`);
});
app.on('child-process-gone', (_e, details) => {
misc.writeServerLog(`Child process gone: type=${details.type}, reason=${details.reason}, exitCode=${details.exitCode}`);
});

// Override the paths above, if a developer needs to
if (fs.existsSync('dev_config.json')) {
try {
Expand Down
16 changes: 16 additions & 0 deletions web/pgadmin/browser/templates/browser/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,22 @@
});
}
}

// Uncaught errors do not pass through console.error, so they would
// otherwise never reach the log. This matters most for errors thrown
// whilst React renders: React 19 reports those with reportError() and
// then unmounts the whole tree, leaving a blank window.
const logUncaught = (kind, err) => {
window.electronUI?.log(`--------------[UI ${kind}]---------------
${parseConsoleArgs([err])}
------------[UI End]----------------`);
};
window.addEventListener('error', (event) => {
logUncaught('uncaught error', event.error ?? event.message);
});
window.addEventListener('unhandledrejection', (event) => {
logUncaught('unhandled rejection', event.reason);
});
}
try {
require(
Expand Down
Loading