big rework of error handling on requests
- central point for checking for 'error: "out of date"' response from server - in 'out of date' state, an error dialog is shown and no further requests are sent to the server - request queue has central point for request adding - now request count is accurate, not just for COMM requests - request error count is cleared after a period of no requests failing
This commit is contained in:
@ -11,27 +11,9 @@ window.updateGameScore = function(data) {
|
||||
return;
|
||||
}
|
||||
|
||||
// hacky - but here is as good as any for a location
|
||||
// tne niantic servers include a 'version' parameter with the requests. this is changed for any site update they
|
||||
// roll out, even when the protocol has no changes at all. (and sometimes when there's no other client javascript
|
||||
// changes of any kind!)
|
||||
if (data.error || (data.indexOf && data.indexOf('"error"') != -1)) {
|
||||
if (data.error == 'out of date') {
|
||||
dialog({
|
||||
title: 'Reload IITC',
|
||||
html: '<p>IITC is using an outdated version code. This will happen when Niantic update the standard intel site.</p>'
|
||||
+'<p>You need to reload the page to get the updated changes.</p>'
|
||||
+'<p>If you have just reloaded the page, then an old version of the standard site script is cached somewhere.'
|
||||
+'In this case, try clearing your cache, or waiting 15-30 minutes for the stale data to expire.</p>',
|
||||
buttons: {
|
||||
'RELOAD': function() { window.location.reload(); }
|
||||
}
|
||||
});
|
||||
return;
|
||||
|
||||
} else {
|
||||
console.error('game score failed to load');
|
||||
}
|
||||
if (data && data.error) {
|
||||
// TODO? better retry handling in here...
|
||||
console.error('game score failed to load');
|
||||
}
|
||||
|
||||
window.updateGameScoreFailCount = 0;
|
||||
@ -47,5 +29,6 @@ window.updateGameScore = function(data) {
|
||||
// help cursor via “#gamestat span”
|
||||
$('#gamestat').attr('title', 'Resistance:\t'+r+' MindUnits\nEnlightened:\t'+e+' MindUnits');
|
||||
|
||||
// TODO: idle handling - don't refresh when IITC is idle!
|
||||
window.setTimeout('window.updateGameScore', REFRESH_GAME_SCORE*1000);
|
||||
}
|
||||
|
Reference in New Issue
Block a user