Skip to content
This repository was archived by the owner on Feb 22, 2024. It is now read-only.

Commit a74789e

Browse files
committed
Added more error handling for authorize and landing company
1 parent c7ec1a6 commit a74789e

File tree

3 files changed

+26
-8
lines changed

3 files changed

+26
-8
lines changed

src/instruments/instruments.es6

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,10 @@ function refresh_active_symbols() {
7676
const landing_company = data.landing_company
7777
get_active_symbol(landing_company, country);
7878
});
79-
});
79+
})
80+
.catch((err) => {
81+
$.growl.error({ message: err.message });
82+
});
8083
} else {
8184
get_active_symbol();
8285
}

src/navigation/navigation.es6

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -337,11 +337,14 @@ export const getLandingCompany = () => {
337337
return 'do-nothing'; // 5-d
338338
}
339339
return 'upgrade-mlt'; // 3-a (calls the normal account opening api which creates an mlt, mx or cr account).
340-
});
340+
})
341+
.catch((err) => {
342+
$.growl.error({ message: err.message });
343+
});;
341344
})
342345
.catch((err) => {
343346
$.growl.error({ message: err.message });
344-
});;
347+
});
345348
}
346349

347350
export const init = (callback) => {

src/websockets/binary_websockets.es6

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -83,9 +83,9 @@ const onclose = () => {
8383
setTimeout( () => tracker.reopen_unique_dialogs(unique_dialogs), 0);
8484
}
8585
)
86-
.catch((err) => {
87-
$.growl.error({ message: err.message });
88-
});;
86+
.catch((err) => {
87+
$.growl.error({ message: err.message });
88+
});
8989
}
9090
}, 1000);
9191
});
@@ -259,7 +259,10 @@ const send_authenticated_request = (data) => {
259259
const oauth = local_storage.get('oauth');
260260
let token = oauth[0].token;
261261
return authenticate(token)
262-
.then(send_it);
262+
.then(send_it)
263+
.catch((err) => {
264+
$.growl.error({ message: err.message });
265+
});;
263266
}
264267
else
265268
return Promise.reject({ message: 'Please log in'.i18n()});
@@ -359,6 +362,9 @@ export const proposal_open_contract = {
359362
proposal_open_contract_forget[contract_id] = undefined;
360363
return data;
361364
})
365+
.catch((err) => {
366+
$.growl.error({ message: err.message });
367+
});
362368
};
363369
if(proposal.stream_id) {
364370
proposal_open_contract_forget[contract_id] = forgetter();
@@ -369,6 +375,9 @@ export const proposal_open_contract = {
369375
if(proposal.stream_id) /* proposal request had not exceptions */
370376
return forgetter();
371377
else return; /* no stream, no need to forget */
378+
})
379+
.catch((err) => {
380+
$.growl.error({ message: err.message });
372381
});
373382
}
374383
return proposal_open_contract_forget[contract_id];
@@ -445,7 +454,10 @@ export const cached = {
445454
(up) => {
446455
delete cached_promises[key]; throw up;
447456
} /* on reject: clear cache */
448-
);
457+
)
458+
.catch((err) => {
459+
$.growl.error({ message: err.message });
460+
});
449461
},
450462
/* return the promise from last successfull authentication request,
451463
if the session is not already authorized will send an authentication request */

0 commit comments

Comments
 (0)