Skip to content

Commit bcba2a3

Browse files
author
Cookiezaurs
committed
[dashboards] Do not show error if request is cancelled.
1 parent e89a359 commit bcba2a3

File tree

1 file changed

+17
-5
lines changed

1 file changed

+17
-5
lines changed

plugins/dashboards/frontend/public/javascripts/countly.models.js

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,13 @@
22

33
(function(countlyDashboards) {
44

5+
var isRequestCancelled = function(e) {
6+
var isCancelled = false;
7+
if (e && e.statusText === "abort") {
8+
isCancelled = true;
9+
}
10+
return isCancelled;
11+
};
512
countlyDashboards.factory = {
613
dashboards: {
714
getEmpty: function() {
@@ -643,11 +650,16 @@
643650

644651
return dashbaord;
645652
}).catch(function(e) {
646-
log(e);
647-
CountlyHelpers.notify({
648-
message: "Something went wrong while fetching the dashbaord!",
649-
type: "error"
650-
});
653+
if (!isRequestCancelled(e)) {
654+
log(e);
655+
CountlyHelpers.notify({
656+
message: "Something went wrong while fetching the dashbaord!",
657+
type: "error"
658+
});
659+
}
660+
else {
661+
log("Request cancelled: " + e);
662+
}
651663

652664
return false;
653665
});

0 commit comments

Comments
 (0)