perf(core): better communication of internal exceptions

This commit is contained in:
Fabio Di Stasio 2021-09-15 15:31:57 +02:00
parent d4888ad8fb
commit abd46aa322
4 changed files with 25 additions and 5 deletions

View File

@ -104,14 +104,14 @@
"sql-formatter": "^4.0.2",
"ssh2-promise": "^0.2.0",
"v-mask": "^2.2.4",
"vue-i18n": "^8.24.4",
"vue-i18n": "^8.25.1",
"vuedraggable": "^2.24.3",
"vuex": "^3.6.2"
},
"devDependencies": {
"@babel/eslint-parser": "^7.15.4",
"cross-env": "^7.0.2",
"electron": "^14.0.0",
"electron": "^14.0.1",
"electron-builder": "^22.11.7",
"electron-devtools-installer": "^3.2.0",
"electron-webpack": "^2.8.2",
@ -122,12 +122,12 @@
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-promise": "^5.1.0",
"eslint-plugin-vue": "^7.17.0",
"sass": "^1.39.2",
"sass": "^1.40.0",
"sass-loader": "^10.2.0",
"standard-version": "^9.3.1",
"stylelint": "^13.13.1",
"stylelint-config-standard": "^22.0.0",
"stylelint-scss": "^3.20.1",
"stylelint-scss": "^3.21.0",
"vue": "^2.6.14",
"vue-template-compiler": "^2.6.14",
"webpack": "^4.46.0"

View File

@ -97,7 +97,16 @@ else {
app.on('ready', async () => {
mainWindow = await createMainWindow();
Menu.setApplicationMenu(null);
if (isDevelopment)
mainWindow.webContents.openDevTools();
process.on('uncaughtException', error => {
mainWindow.webContents.send('unhandled-exception', error);
});
process.on('unhandledRejection', error => {
mainWindow.webContents.send('unhandled-exception', error);
});
});
}

View File

@ -5,12 +5,14 @@ import Vuex from 'vuex';
import application from './modules/application.store';
import settings from './modules/settings.store';
import history from './modules/history.store';
import scratchpad from './modules/scratchpad.store';
import connections from './modules/connections.store';
import workspaces from './modules/workspaces.store';
import notifications from './modules/notifications.store';
import ipcUpdates from './plugins/ipcUpdates';
import ipcExceptions from './plugins/ipcExceptions';
Vue.use(Vuex);
@ -19,12 +21,14 @@ export default new Vuex.Store({
modules: {
application,
settings,
history,
scratchpad,
connections,
workspaces,
notifications
},
plugins: [
ipcUpdates
ipcUpdates,
ipcExceptions
]
});

View File

@ -0,0 +1,7 @@
import { ipcRenderer } from 'electron';
export default store => {
ipcRenderer.on('unhandled-exception', (event, error) => {
store.dispatch('notifications/addNotification', { status: 'error', message: error.message });
});
};