Merge pull request #2366 from yougotwill/improved_global_error_handling

fix: global error dialog box's 'copy to clipboard' option shouldn't quit the app
pull/2372/head
Audric Ackermann 3 years ago committed by GitHub
commit 5b02d1e70e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -6,7 +6,7 @@ import { ConsoleCustom } from './logging'; // checked - only node
// We use hard-coded strings until we're able to update these strings from the locale.
let quitText = 'Quit';
let copyErrorAndQuitText = 'Copy error and quit';
let copyErrorAndQuitText = 'Copy error to clipboard';
async function handleError(prefix: string, error: any) {
if ((console as ConsoleCustom)._error) {
@ -17,21 +17,21 @@ async function handleError(prefix: string, error: any) {
if (app.isReady()) {
// title field is not shown on macOS, so we don't use it
const button = await dialog.showMessageBox({
buttons: [quitText, copyErrorAndQuitText],
buttons: [copyErrorAndQuitText, quitText],
defaultId: 0,
detail: redactAll(error.stack),
message: prefix,
noLink: true,
type: 'error',
});
if (button.response === 1) {
if (button.response === 0) {
clipboard.writeText(`${prefix}\n\n${redactAll(error.stack)}`);
} else if (button.response === 1) {
app.exit(1);
}
} else {
dialog.showErrorBox(prefix, error.stack);
}
app.exit(1);
}
export const updateLocale = (messages: LocaleMessagesType) => {

Loading…
Cancel
Save