Added a try catch to the loading to inform user

This commit is contained in:
Rsl1122 2019-08-26 11:46:11 +03:00
parent f2b6040469
commit 1bc8fbed42
4 changed files with 556 additions and 524 deletions

View File

@ -815,6 +815,7 @@
<script src="js/network-values.js"></script>
<script>
try {
setLoadingText('Calculating values..');
jsonRequest("../v1/network/overview", loadNetworkOverviewValues);
jsonRequest("../v1/network/servers", loadServerBoxes);
@ -971,6 +972,13 @@
setTimeout(function () {
$('.page-loader').fadeOut();
}, 50);
} catch (loadingError) {
setLoadingText("Error occurred, see Developer Console (Ctrl+Shift+I) - Please report this: " + loadingError);
setTimeout(function () {
$('.page-loader').fadeOut();
}, 10000);
throw loadingError;
}
function openFunc(i) {
return function () {

View File

@ -737,6 +737,7 @@
<script src="js/player-values.js"></script>
<script>
try {
setLoadingText('Loading player values..');
jsonRequest("../v1/player?player=${playerName}", function (json, error) {
loadPlayerOverviewValues(json, error);
@ -798,6 +799,13 @@
setTimeout(function () {
$('.page-loader').fadeOut();
}, 50);
} catch (loadingError) {
setLoadingText("Error occurred, see Developer Console (Ctrl+Shift+I) - Please report this: " + loadingError);
setTimeout(function () {
$('.page-loader').fadeOut();
}, 10000);
throw loadingError;
}
function openFunc(i) {
return function () {

View File

@ -271,6 +271,7 @@
<script src="js/color-selector.js"></script>
<script>
try {
jsonRequest("../v1/players", function (playersTableJson, error) {
if (playersTableJson) {
$('.player-table').DataTable({
@ -286,6 +287,13 @@
})
}
});
} catch (loadingError) {
window.alert("Error occurred, see Developer Console (Ctrl+Shift+I) - Please report this: " + loadingError);
setTimeout(function () {
$('.page-loader').fadeOut();
}, 10000);
throw loadingError;
}
</script>
</body>

View File

@ -1290,6 +1290,7 @@
<script src="js/server-values.js"></script>
<script>
try {
var x = document.getElementById("content");
setLoadingText('Calculating values..');
@ -1607,6 +1608,13 @@
setTimeout(function () {
$('.page-loader').fadeOut();
}, 50);
} catch (loadingError) {
setLoadingText("Error occurred, see Developer Console (Ctrl+Shift+I) - Please report this: " + loadingError);
setTimeout(function () {
$('.page-loader').fadeOut();
}, 10000);
throw loadingError;
}
function openPageFunc() {
var navButtons = document.getElementsByClassName("nav-button");