Adding extra error logging on the client side.

This commit is contained in:
marcins78@gmail.com
2011-10-19 23:53:47 +00:00
parent c869613fb9
commit f26c430678
3 changed files with 55 additions and 37 deletions

View File

@@ -19,6 +19,10 @@ var ChatBoxUI = Class.extend({
if (xhr.status == 401) { if (xhr.status == 401) {
that.appendMessage("Chat problem - You're not logged in, go to the <a href='index.html'>main page</a> to log in", "warningMessage"); that.appendMessage("Chat problem - You're not logged in, go to the <a href='index.html'>main page</a> to log in", "warningMessage");
return; return;
} else {
that.appendMessage("Chat had a problem communicating with the server (" + xhr.status + "), no new messages will be displayed, but your messages still might get sent.", "warningMessage");
that.appendMessage("Reload the browser page (press F5) to resume the chat.", "warningMessage");
return;
} }
} }
that.appendMessage("Chat had a problem communicating with the server, no new messages will be displayed, but your messages still might get sent.", "warningMessage"); that.appendMessage("Chat had a problem communicating with the server, no new messages will be displayed, but your messages still might get sent.", "warningMessage");

View File

@@ -65,6 +65,16 @@ var GempLotrGameUI = Class.extend({
this.communication = new GempLotrCommunication("/gemp-lotr/server", this.communication = new GempLotrCommunication("/gemp-lotr/server",
function(xhr, ajaxOptions, thrownError) { function(xhr, ajaxOptions, thrownError) {
if (thrownError != "abort") { if (thrownError != "abort") {
if (xhr != null) {
if (xhr.status == 401) {
that.chatBox.appendMessage("Game problem - You're not logged in, go to the <a href='index.html'>main page</a> to log in", "warningMessage");
return;
} else {
that.chatBox.appendMessage("There was a problem communicating with the server (" + xhr.status + "), if the game is finished, it has been removed, otherwise you have lost connection to the server.", "warningMessage");
that.chatBox.appendMessage("Refresh the page (press F5) to resume the game, or press back on your browser to get back to the Game Hall.", "warningMessage");
return;
}
}
that.chatBox.appendMessage("There was a problem communicating with the server, if the game is finished, it has been removed, otherwise you have lost connection to the server.", "warningMessage"); that.chatBox.appendMessage("There was a problem communicating with the server, if the game is finished, it has been removed, otherwise you have lost connection to the server.", "warningMessage");
that.chatBox.appendMessage("Refresh the page (press F5) to resume the game, or press back on your browser to get back to the Game Hall.", "warningMessage"); that.chatBox.appendMessage("Refresh the page (press F5) to resume the game, or press back on your browser to get back to the Game Hall.", "warningMessage");
} }
@@ -276,21 +286,21 @@ var GempLotrGameUI = Class.extend({
initializeDialogs: function() { initializeDialogs: function() {
this.smallDialog = $("<div></div>") this.smallDialog = $("<div></div>")
.dialog({ .dialog({
autoOpen: false, autoOpen: false,
closeOnEscape: false, closeOnEscape: false,
resizable: false, resizable: false,
width: 400, width: 400,
height: 200 height: 200
}); });
this.cardActionDialog = $("<div></div>") this.cardActionDialog = $("<div></div>")
.dialog({ .dialog({
autoOpen: false, autoOpen: false,
closeOnEscape: false, closeOnEscape: false,
resizable: true, resizable: true,
width: 600, width: 600,
height: 300 height: 300
}); });
var that = this; var that = this;
@@ -305,15 +315,15 @@ var GempLotrGameUI = Class.extend({
this.infoDialog = $("<div></div>") this.infoDialog = $("<div></div>")
.dialog({ .dialog({
autoOpen: false, autoOpen: false,
closeOnEscape: true, closeOnEscape: true,
resizable: true, resizable: true,
title: "Card information", title: "Card information",
minHeight: 80, minHeight: 80,
minWidth: 200, minWidth: 200,
width: Math.max(600, width * 0.75), width: Math.max(600, width * 0.75),
height: Math.max(300, height * 0.75) height: Math.max(300, height * 0.75)
}); });
var swipeOptions = { var swipeOptions = {
threshold: 20, threshold: 20,
@@ -694,13 +704,13 @@ var GempLotrGameUI = Class.extend({
this.smallDialog this.smallDialog
.html(text + "<br /><input id='integerDecision' type='text' value='0'>") .html(text + "<br /><input id='integerDecision' type='text' value='0'>")
.dialog("option", "buttons", .dialog("option", "buttons",
{ {
"OK": function() { "OK": function() {
$(this).dialog("close"); $(this).dialog("close");
that.decisionFunction(id, $("#integerDecision").val()); that.decisionFunction(id, $("#integerDecision").val());
} }
} }
); );
$("#integerDecision").SpinnerControl({ type: 'range', $("#integerDecision").SpinnerControl({ type: 'range',
typedata: { typedata: {
@@ -732,13 +742,13 @@ var GempLotrGameUI = Class.extend({
this.smallDialog this.smallDialog
.html(html) .html(html)
.dialog("option", "buttons", .dialog("option", "buttons",
{ {
"OK": function() { "OK": function() {
$(this).dialog("close"); $(this).dialog("close");
that.decisionFunction(id, $("#multipleChoiceDecision").val()); that.decisionFunction(id, $("#multipleChoiceDecision").val());
} }
} }
); );
this.smallDialog.dialog("open"); this.smallDialog.dialog("open");
}, },
@@ -987,8 +997,8 @@ var GempLotrGameUI = Class.extend({
$(div).find('LI.hover').removeClass('hover'); $(div).find('LI.hover').removeClass('hover');
$(this).parent().addClass('hover'); $(this).parent().addClass('hover');
}).mouseout(function() { }).mouseout(function() {
$(div).find('LI.hover').removeClass('hover'); $(div).find('LI.hover').removeClass('hover');
}); });
var getRidOfContextMenu = function() { var getRidOfContextMenu = function() {
$(div).remove(); $(div).remove();

View File

@@ -17,6 +17,10 @@ var GempLotrHallUI = Class.extend({
if (xhr.status == 401) { if (xhr.status == 401) {
chat.appendMessage("Game hall problem - You're not logged in, go to the <a href='index.html'>main page</a> to log in", "warningMessage"); chat.appendMessage("Game hall problem - You're not logged in, go to the <a href='index.html'>main page</a> to log in", "warningMessage");
return; return;
} else {
chat.appendMessage("The game hall had a problem communicating with the server (" + xhr.status + "), no new updates will be displayed.", "warningMessage");
chat.appendMessage("Reload the browser page (press F5) to resume the game hall functionality.", "warningMessage");
return;
} }
} }
chat.appendMessage("The game hall had a problem communicating with the server, no new updates will be displayed.", "warningMessage"); chat.appendMessage("The game hall had a problem communicating with the server, no new updates will be displayed.", "warningMessage");