New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore: log hint on renderer crash #25317
Conversation
1fae775
to
87b2259
Compare
Release Notes Persisted
|
I have automatically backported this PR to "10-x-y", please check out #25472 |
I have automatically backported this PR to "9-x-y", please check out #25473 |
I have automatically backported this PR to "11-x-y", please check out #25474 |
@@ -461,6 +461,11 @@ const addReturnValueToEvent = (event: any) => { | |||
}); | |||
}; | |||
|
|||
const loggingEnabled = () => { | |||
return Object.prototype.hasOwnProperty.call(process.env, 'ELECTRON_ENABLE_LOGGING') || | |||
process.argv.some(arg => arg.toLowerCase().startsWith('--enable-logging')); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
better to use app.commandLine
to check this sort of thing.
process.argv.some(arg => arg.toLowerCase().startsWith('--enable-logging')); | |
app.commandLine.hasSwitch('enable-logging') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
|
||
// Log out a hint to help users better debug renderer crashes. | ||
if (loggingEnabled()) { | ||
console.info('Renderer process crashed - see https://www.electronjs.org/docs/tutorial/application-debugging for potential debugging information.'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we give some more info about the crash here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Description of Change
Refs #25141 (comment).
It's clear that we can and should provide more helpful tips when debugging certain types of crashes in Electron, but this seems like a small and helpful step we can take towards helping users debug renderer crashes. This will now log a small hint to console when the renderer crashes, telling them that they can set the logging env var to potentially see more information.
cc @ckerr @jkleinsc @zcbenz
Checklist
npm test
passesRelease Notes
Notes: Added a small console hint to console to help debug renderer crashes.