diff options
author | vantezzen <hello@vantezzen.io> | 2019-10-26 15:50:39 +0200 |
---|---|---|
committer | vantezzen <hello@vantezzen.io> | 2019-10-26 15:50:39 +0200 |
commit | 49e351d6ba03bf21543585d17eb4260516843978 (patch) | |
tree | 743344c53175aad988f0d725c7bb3c31a8465261 | |
parent | Attempt at fixing Travis conditional sed (diff) | |
download | ferdium-app-49e351d6ba03bf21543585d17eb4260516843978.tar.gz ferdium-app-49e351d6ba03bf21543585d17eb4260516843978.tar.zst ferdium-app-49e351d6ba03bf21543585d17eb4260516843978.zip |
Extend debug information
-rw-r--r-- | src/stores/AppStore.js | 14 | ||||
-rw-r--r-- | src/stores/GlobalErrorStore.js | 29 |
2 files changed, 38 insertions, 5 deletions
diff --git a/src/stores/AppStore.js b/src/stores/AppStore.js index 59b100b55..894c19347 100644 --- a/src/stores/AppStore.js +++ b/src/stores/AppStore.js | |||
@@ -227,6 +227,9 @@ export default class AppStore extends Store { | |||
227 | } | 227 | } |
228 | 228 | ||
229 | @computed get debugInfo() { | 229 | @computed get debugInfo() { |
230 | const settings = JSON.parse(JSON.stringify(this.stores.settings.app)); | ||
231 | settings.lockedPassword = '******'; | ||
232 | |||
230 | return { | 233 | return { |
231 | host: { | 234 | host: { |
232 | platform: process.platform, | 235 | platform: process.platform, |
@@ -238,19 +241,20 @@ export default class AppStore extends Store { | |||
238 | electron: process.versions.electron, | 241 | electron: process.versions.electron, |
239 | installedRecipes: this.stores.recipes.all.map(recipe => ({ id: recipe.id, version: recipe.version })), | 242 | installedRecipes: this.stores.recipes.all.map(recipe => ({ id: recipe.id, version: recipe.version })), |
240 | devRecipes: this.stores.recipePreviews.dev.map(recipe => ({ id: recipe.id, version: recipe.version })), | 243 | devRecipes: this.stores.recipePreviews.dev.map(recipe => ({ id: recipe.id, version: recipe.version })), |
241 | services: this.stores.services.all.map(service => ({ | 244 | services: this.stores.services.all.map(service => ({ |
242 | id: service.id, | 245 | id: service.id, |
243 | recipe: service.recipe.id, | 246 | recipe: service.recipe.id, |
244 | isAttached: service.isAttached, | 247 | isAttached: service.isAttached, |
245 | isActive: service.isActive, | 248 | isActive: service.isActive, |
246 | isEnabled: service.isEnabled, | 249 | isEnabled: service.isEnabled, |
247 | isHibernating: service.isHibernating, | 250 | isHibernating: service.isHibernating, |
248 | hasCrashed: service.hasCrashed, | 251 | hasCrashed: service.hasCrashed, |
249 | isDarkModeEnabled: service.isDarkModeEnabled, | 252 | isDarkModeEnabled: service.isDarkModeEnabled, |
250 | })), | 253 | })), |
254 | errors: this.stores.globalError.errors, | ||
251 | workspaces: this.stores.workspaces.workspaces.map(workspace => ({ id: workspace.id, services: workspace.services })), | 255 | workspaces: this.stores.workspaces.workspaces.map(workspace => ({ id: workspace.id, services: workspace.services })), |
252 | windowSettings: readJsonSync(path.join(app.getPath('userData'), 'window-state.json')), | 256 | windowSettings: readJsonSync(path.join(app.getPath('userData'), 'window-state.json')), |
253 | settings: this.stores.settings.app, | 257 | settings, |
254 | features: this.stores.features.features, | 258 | features: this.stores.features.features, |
255 | user: this.stores.user.data.id, | 259 | user: this.stores.user.data.id, |
256 | }, | 260 | }, |
diff --git a/src/stores/GlobalErrorStore.js b/src/stores/GlobalErrorStore.js index 8bdafb68c..dbcc56606 100644 --- a/src/stores/GlobalErrorStore.js +++ b/src/stores/GlobalErrorStore.js | |||
@@ -5,14 +5,32 @@ import Request from './lib/Request'; | |||
5 | export default class GlobalErrorStore extends Store { | 5 | export default class GlobalErrorStore extends Store { |
6 | @observable error = null; | 6 | @observable error = null; |
7 | 7 | ||
8 | @observable errors = []; | ||
9 | |||
8 | @observable response = {}; | 10 | @observable response = {}; |
9 | 11 | ||
10 | constructor(...args) { | 12 | constructor(...args) { |
11 | super(...args); | 13 | super(...args); |
12 | 14 | ||
15 | window.onerror = this._handleConsoleError.bind(this); | ||
16 | |||
17 | const origConsoleError = console.error; | ||
18 | console.error = (...args) => { | ||
19 | this._handleConsoleError.call(this, args); | ||
20 | origConsoleError.apply(this, args); | ||
21 | } | ||
22 | |||
13 | Request.registerHook(this._handleRequests); | 23 | Request.registerHook(this._handleRequests); |
14 | } | 24 | } |
15 | 25 | ||
26 | _handleConsoleError(error, url, line) { | ||
27 | this.errors.push({ | ||
28 | error, | ||
29 | url, | ||
30 | line | ||
31 | }); | ||
32 | } | ||
33 | |||
16 | _handleRequests = action(async (request) => { | 34 | _handleRequests = action(async (request) => { |
17 | if (request.isError) { | 35 | if (request.isError) { |
18 | this.error = request.error; | 36 | this.error = request.error; |
@@ -28,6 +46,17 @@ export default class GlobalErrorStore extends Store { | |||
28 | // this.actions.user.logout({ serverLogout: true }); | 46 | // this.actions.user.logout({ serverLogout: true }); |
29 | } | 47 | } |
30 | } | 48 | } |
49 | |||
50 | this.errors.push({ | ||
51 | request: { | ||
52 | result: request.result, | ||
53 | wasExecuted: request.wasExecuted, | ||
54 | method: request._method, | ||
55 | }, | ||
56 | error: this.error, | ||
57 | response: this.response, | ||
58 | server: window.ferdi.stores.settings.app.server, | ||
59 | }); | ||
31 | } else { | 60 | } else { |
32 | window.ferdi.stores.app.authRequestFailed = false; | 61 | window.ferdi.stores.app.authRequestFailed = false; |
33 | } | 62 | } |