aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLibravatar vantezzen <hello@vantezzen.io>2019-10-27 20:15:33 +0100
committerLibravatar vantezzen <hello@vantezzen.io>2019-10-27 20:15:33 +0100
commit769e553fae2abcb1559fd078ac2666a16482c9b5 (patch)
treeb11fca36c2697fb21336352b82980032d252d0d6 /src
parentAdd information about next release (diff)
downloadferdium-app-769e553fae2abcb1559fd078ac2666a16482c9b5.tar.gz
ferdium-app-769e553fae2abcb1559fd078ac2666a16482c9b5.tar.zst
ferdium-app-769e553fae2abcb1559fd078ac2666a16482c9b5.zip
Extend debug information
Diffstat (limited to 'src')
-rw-r--r--src/stores/AppStore.js2
-rw-r--r--src/stores/GlobalErrorStore.js45
2 files changed, 35 insertions, 12 deletions
diff --git a/src/stores/AppStore.js b/src/stores/AppStore.js
index 124c117b0..0756a05eb 100644
--- a/src/stores/AppStore.js
+++ b/src/stores/AppStore.js
@@ -253,7 +253,7 @@ export default class AppStore extends Store {
253 hasCrashed: service.hasCrashed, 253 hasCrashed: service.hasCrashed,
254 isDarkModeEnabled: service.isDarkModeEnabled, 254 isDarkModeEnabled: service.isDarkModeEnabled,
255 })), 255 })),
256 errors: this.stores.globalError.errors, 256 messages: this.stores.globalError.messages,
257 workspaces: this.stores.workspaces.workspaces.map(workspace => ({ id: workspace.id, services: workspace.services })), 257 workspaces: this.stores.workspaces.workspaces.map(workspace => ({ id: workspace.id, services: workspace.services })),
258 windowSettings: readJsonSync(path.join(app.getPath('userData'), 'window-state.json')), 258 windowSettings: readJsonSync(path.join(app.getPath('userData'), 'window-state.json')),
259 settings, 259 settings,
diff --git a/src/stores/GlobalErrorStore.js b/src/stores/GlobalErrorStore.js
index 09c215c3e..0a3e62731 100644
--- a/src/stores/GlobalErrorStore.js
+++ b/src/stores/GlobalErrorStore.js
@@ -5,30 +5,52 @@ import Request from './lib/Request';
5export default class GlobalErrorStore extends Store { 5export default class GlobalErrorStore extends Store {
6 @observable error = null; 6 @observable error = null;
7 7
8 @observable errors = []; 8 @observable messages = [];
9 9
10 @observable response = {}; 10 @observable response = {};
11 11
12 constructor(...args) { 12 constructor(...args) {
13 super(...args); 13 super(...args);
14 14
15 window.onerror = this._handleConsoleError.bind(this); 15 window.onerror = (...errorArgs) => {
16 this._handleConsoleError.call(this, ['error', ...errorArgs])
17 };
16 18
17 const origConsoleError = console.error; 19 const origConsoleError = console.error;
18 console.error = (...errorArgs) => { 20 window.console.error = (...errorArgs) => {
19 this._handleConsoleError.call(this, errorArgs); 21 this._handleConsoleError.call(this, ['error', ...errorArgs]);
20 origConsoleError.apply(this, errorArgs); 22 origConsoleError.apply(this, errorArgs);
21 }; 23 };
24
25 const origConsoleLog = console.log;
26 window.console.log = (...logArgs) => {
27 this._handleConsoleError.call(this, ['log', ...logArgs]);
28 origConsoleLog.apply(this, logArgs);
29 };
30
31 const origConsoleInfo = console.info;
32 window.console.info = (...infoArgs) => {
33 this._handleConsoleError.call(this, ['info', ...infoArgs]);
34 origConsoleInfo.apply(this, infoArgs);
35 };
22 36
23 Request.registerHook(this._handleRequests); 37 Request.registerHook(this._handleRequests);
24 } 38 }
25 39
26 _handleConsoleError(error, url, line) { 40 _handleConsoleError(type, error, url, line) {
27 this.errors.push({ 41 if (typeof type === "object" && type.length && type.length >= 1) {
28 error, 42 this.messages.push({
29 url, 43 type: type[0],
30 line, 44 info: type,
31 }); 45 });
46 } else {
47 this.messages.push({
48 type,
49 error,
50 url,
51 line,
52 });
53 }
32 } 54 }
33 55
34 _handleRequests = action(async (request) => { 56 _handleRequests = action(async (request) => {
@@ -47,7 +69,8 @@ export default class GlobalErrorStore extends Store {
47 } 69 }
48 } 70 }
49 71
50 this.errors.push({ 72 this.messages.push({
73 type: 'error',
51 request: { 74 request: {
52 result: request.result, 75 result: request.result,
53 wasExecuted: request.wasExecuted, 76 wasExecuted: request.wasExecuted,