From: Darren Date: Mon, 20 May 2013 13:37:23 +0000 (+0100) Subject: More connection errors now displayed X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=13cdb96ede3b876f8720eae0e677e490f52812aa;p=KiwiIRC.git More connection errors now displayed --- diff --git a/client/assets/dev/model_newconnection.js b/client/assets/dev/model_newconnection.js index 368f8bf..5bf64ca 100644 --- a/client/assets/dev/model_newconnection.js +++ b/client/assets/dev/model_newconnection.js @@ -63,6 +63,11 @@ _kiwi.model.NewConnection = Backbone.Collection.extend({ onNewNetwork: function(err, network) { + // Show any errors if given + if (err) { + this.view.showError(err); + } + if (network && this.connect_details) { network.auto_join = { channel: this.connect_details.channel, diff --git a/client/assets/dev/view.js b/client/assets/dev/view.js index d5dce46..1a763af 100644 --- a/client/assets/dev/view.js +++ b/client/assets/dev/view.js @@ -379,8 +379,25 @@ _kiwi.view.ServerSelect = function () { } }, - showError: function (event) { - this.setStatus('Error connecting', 'error'); + showError: function (error_reason) { + var err_text = 'Error Connecting'; + + if (error_reason) { + switch (error_reason) { + case 'ENOTFOUND': + err_text = 'Server not found'; + break; + + case 'ECONNREFUSED': + err_text += ' (Connection refused)'; + break; + + default: + err_text += ' (' + error_reason + ')'; + } + } + + this.setStatus(err_text, 'error'); $('button', this.$el).attr('disabled', null); this.show(); }