Skip to content

Commit

Permalink
perf(core): better communication of internal exceptions
Browse files Browse the repository at this point in the history
  • Loading branch information
Fabio286 committed Sep 15, 2021
1 parent d4888ad commit abd46aa
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 5 deletions.
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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"
Expand Down
9 changes: 9 additions & 0 deletions src/main/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
});
});
}
6 changes: 5 additions & 1 deletion src/renderer/store/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand All @@ -19,12 +21,14 @@ export default new Vuex.Store({
modules: {
application,
settings,
history,
scratchpad,
connections,
workspaces,
notifications
},
plugins: [
ipcUpdates
ipcUpdates,
ipcExceptions
]
});
7 changes: 7 additions & 0 deletions src/renderer/store/plugins/ipcExceptions.js
Original file line number Diff line number Diff line change
@@ -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 });
});
};

0 comments on commit abd46aa

Please sign in to comment.