diff options
author | 2021-09-14 19:58:52 +0200 | |
---|---|---|
committer | 2021-09-14 19:58:52 +0200 | |
commit | 95df3522a15631abc51a4295cae0ea401a8d4e1e (patch) | |
tree | e5eb0f368c947683f01458e912f21756fb0d99cb /src/stores/GlobalErrorStore.js | |
parent | docs: add sad270 as a contributor for bug, userTesting [skip ci] (#1941) (diff) | |
download | ferdium-app-95df3522a15631abc51a4295cae0ea401a8d4e1e.tar.gz ferdium-app-95df3522a15631abc51a4295cae0ea401a8d4e1e.tar.zst ferdium-app-95df3522a15631abc51a4295cae0ea401a8d4e1e.zip |
feat: add eslint-plugin-unicorn (#1936)
Diffstat (limited to 'src/stores/GlobalErrorStore.js')
-rw-r--r-- | src/stores/GlobalErrorStore.js | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/stores/GlobalErrorStore.js b/src/stores/GlobalErrorStore.js index aacaa247f..7cbfdc608 100644 --- a/src/stores/GlobalErrorStore.js +++ b/src/stores/GlobalErrorStore.js | |||
@@ -12,9 +12,9 @@ export default class GlobalErrorStore extends Store { | |||
12 | constructor(...args) { | 12 | constructor(...args) { |
13 | super(...args); | 13 | super(...args); |
14 | 14 | ||
15 | window.onerror = (...errorArgs) => { | 15 | window.addEventListener('error', (...errorArgs) => { |
16 | this._handleConsoleError.call(this, ['error', ...errorArgs]); | 16 | this._handleConsoleError.call(this, ['error', ...errorArgs]); |
17 | }; | 17 | }); |
18 | 18 | ||
19 | const origConsoleError = console.error; | 19 | const origConsoleError = console.error; |
20 | window.console.error = (...errorArgs) => { | 20 | window.console.error = (...errorArgs) => { |
@@ -38,7 +38,7 @@ export default class GlobalErrorStore extends Store { | |||
38 | } | 38 | } |
39 | 39 | ||
40 | _handleConsoleError(type, error, url, line) { | 40 | _handleConsoleError(type, error, url, line) { |
41 | if (typeof type === 'object' && type.length && type.length >= 1) { | 41 | if (typeof type === 'object' && type.length > 0) { |
42 | this.messages.push({ | 42 | this.messages.push({ |
43 | type: type[0], | 43 | type: type[0], |
44 | info: type, | 44 | info: type, |
@@ -53,14 +53,14 @@ export default class GlobalErrorStore extends Store { | |||
53 | } | 53 | } |
54 | } | 54 | } |
55 | 55 | ||
56 | _handleRequests = action(async (request) => { | 56 | _handleRequests = action(async request => { |
57 | if (request.isError) { | 57 | if (request.isError) { |
58 | this.error = request.error; | 58 | this.error = request.error; |
59 | 59 | ||
60 | if (request.error.json) { | 60 | if (request.error.json) { |
61 | try { | 61 | try { |
62 | this.response = await request.error.json(); | 62 | this.response = await request.error.json(); |
63 | } catch (error) { | 63 | } catch { |
64 | this.response = {}; | 64 | this.response = {}; |
65 | } | 65 | } |
66 | if (this.error.status === 401) { | 66 | if (this.error.status === 401) { |