main: better error handling (prevent some error boxes)
This commit is contained in:
parent
03ea75857c
commit
d11f88b992
2 changed files with 12 additions and 13 deletions
|
|
@ -1,11 +1,10 @@
|
|||
var {app, Menu, shell} = require('electron'),
|
||||
var {app, Menu, shell, dialog} = require('electron'),
|
||||
settings = require('./settings'),
|
||||
path = require('path'),
|
||||
infos = require('../package.json')
|
||||
|
||||
app.commandLine.appendSwitch('--touch-events')
|
||||
|
||||
|
||||
if (settings.read('noVsync') || (!settings.cli && settings.read('argv')['disable-vsync'])) {
|
||||
app.commandLine.appendSwitch('--disable-gpu-vsync')
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,6 +2,17 @@ var settings = require('./settings')
|
|||
|
||||
var serverStarted
|
||||
|
||||
if (process.title === 'node') {
|
||||
process.on('uncaughtException', (err)=>{
|
||||
console.error('A JavaScript error occurred in the main process:')
|
||||
console.trace(err)
|
||||
})
|
||||
} else {
|
||||
require('electron').dialog.showErrorBox = (title, err)=>{
|
||||
console.error(title + ': ' + err)
|
||||
}
|
||||
}
|
||||
|
||||
var start = function(readyApp) {
|
||||
|
||||
if (!settings.read('guiOnly') && !serverStarted) {
|
||||
|
|
@ -40,17 +51,6 @@ var start = function(readyApp) {
|
|||
}
|
||||
}
|
||||
|
||||
try {
|
||||
require('electron').dialog.showErrorBox = (title, err)=>{
|
||||
console.error(title + ': ' + err)
|
||||
}
|
||||
} catch(e){
|
||||
process.on('uncaughtException', (err)=>{
|
||||
console.error('A JavaScript error occurred in the main process:')
|
||||
console.trace(err)
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue