aboutsummaryrefslogtreecommitdiffstats
path: root/src/stores/GlobalErrorStore.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/stores/GlobalErrorStore.js')
-rw-r--r--src/stores/GlobalErrorStore.js10
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) {