1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-11-26 22:41:17 +02:00

All: Better handling of startup errors

This commit is contained in:
Laurent Cozic
2018-03-07 19:11:55 +00:00
parent b04d750cec
commit 82e99ca658
5 changed files with 30 additions and 24 deletions

View File

@@ -64,11 +64,17 @@ document.addEventListener('click', (event) => event.preventDefault());
app().start(bridge().processArgv()).then(() => {
require('./gui/Root.min.js');
}).catch((error) => {
// If something goes wrong at this stage we don't have a console or a log file
// so display the error in a message box.
let msg = ['Fatal error:', error.message];
if (error.fileName) msg.push(error.fileName);
if (error.lineNumber) msg.push(error.lineNumber);
if (error.stack) msg.push(error.stack);
bridge().showErrorMessageBox(msg.join('\n'));
if (error.code == 'flagError') {
bridge().showErrorMessageBox(error.message);
} else {
// If something goes wrong at this stage we don't have a console or a log file
// so display the error in a message box.
let msg = ['Fatal error:', error.message];
if (error.fileName) msg.push(error.fileName);
if (error.lineNumber) msg.push(error.lineNumber);
if (error.stack) msg.push(error.stack);
bridge().showErrorMessageBox(msg.join('\n'));
}
bridge().electronApp().exit(1);
});