最新消息:Welcome to the puzzle paradise for programmers! Here, a well-designed puzzle awaits you. From code logic puzzles to algorithmic challenges, each level is closely centered on the programmer's expertise and skills. Whether you're a novice programmer or an experienced tech guru, you'll find your own challenges on this site. In the process of solving puzzles, you can not only exercise your thinking skills, but also deepen your understanding and application of programming knowledge. Come to start this puzzle journey full of wisdom and challenges, with many programmers to compete with each other and show your programming wisdom! Translated with DeepL.com (free version)

javascript - How to disable alert dialogs when errors occur in Atom Electron - Stack Overflow

matteradmin7PV0评论

Is there a way to disable alert dialogs when errors occur in Electron App, or better yet disable ALL dialogs?

Dialogs are useless in headless mode (granted electron is not intended to be a headless app) and just get things stuck.

I'm not necessarily looking for a flag 'disable_dialogs'. Perhaps I could override one method in the main process so that dialogs don't open?

Is there a way to disable alert dialogs when errors occur in Electron App, or better yet disable ALL dialogs?

Dialogs are useless in headless mode (granted electron is not intended to be a headless app) and just get things stuck.

I'm not necessarily looking for a flag 'disable_dialogs'. Perhaps I could override one method in the main process so that dialogs don't open?

Share Improve this question asked Feb 25, 2016 at 7:18 LeMousselLeMoussel 5,77715 gold badges78 silver badges129 bronze badges 2
  • 1 discuss.atom.io/t/… – Adrian Lynch Commented Feb 25, 2016 at 7:20
  • Yep, but no explanation on how to override the method to log to the console instead of the default behavior. – LeMoussel Commented Feb 26, 2016 at 7:34
Add a ment  | 

1 Answer 1

Reset to default 5

Someone has left the following on that discussion thread.

Disable error dialogs by overriding

const electron = require('electron');
const dialog = electron.dialog;

// Disable error dialogs by overriding
dialog.showErrorBox = function(title, content) {
    console.log(`${title}\n${content}`);
};
Post a comment

comment list (0)

  1. No comments so far