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,
}\r
},\r
\r
- showError: function (event) {\r
- this.setStatus('Error connecting', 'error');\r
+ showError: function (error_reason) {\r
+ var err_text = 'Error Connecting';\r
+\r
+ if (error_reason) {\r
+ switch (error_reason) {\r
+ case 'ENOTFOUND':\r
+ err_text = 'Server not found';\r
+ break;\r
+\r
+ case 'ECONNREFUSED':\r
+ err_text += ' (Connection refused)';\r
+ break;\r
+\r
+ default:\r
+ err_text += ' (' + error_reason + ')';\r
+ }\r
+ }\r
+\r
+ this.setStatus(err_text, 'error');\r
$('button', this.$el).attr('disabled', null);\r
this.show();\r
}\r