Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1244)

Unified Diff: remoting/webapp/crd/js/xmpp_connection.js

Issue 955283002: Converted remoting.Error from an enum to a class (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « remoting/webapp/crd/js/wcs_loader.js ('k') | remoting/webapp/crd/js/xmpp_login_handler.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/webapp/crd/js/xmpp_connection.js
diff --git a/remoting/webapp/crd/js/xmpp_connection.js b/remoting/webapp/crd/js/xmpp_connection.js
index 6f56f58da8474a8a22dff9ec89d69a5831c3d3c3..0579a2c766bf42685d32832ad164a83b51ab4bb5 100644
--- a/remoting/webapp/crd/js/xmpp_connection.js
+++ b/remoting/webapp/crd/js/xmpp_connection.js
@@ -39,7 +39,7 @@ remoting.XmppConnection = function() {
/** @private */
this.jid_ = '';
/** @private */
- this.error_ = remoting.Error.NONE;
+ this.error_ = remoting.Error.none();
};
/**
@@ -74,7 +74,7 @@ remoting.XmppConnection.prototype.connect =
base.debug.assert(this.state_ == remoting.SignalStrategy.State.NOT_CONNECTED);
base.debug.assert(this.onStateChangedCallback_ != null);
- this.error_ = remoting.Error.NONE;
+ this.error_ = remoting.Error.none();
var hostnameAndPort = server.split(':', 2);
this.server_ = hostnameAndPort[0];
this.port_ =
@@ -111,8 +111,9 @@ remoting.XmppConnection.prototype.connect =
this.socket_.connect(this.server_, this.port_)
.then(this.onSocketConnected_.bind(this))
.catch(function(error) {
- that.onError_(remoting.Error.NETWORK_FAILURE,
- 'Failed to connect to ' + that.server_ + ': ' + error);
+ that.onError_(
+ new remoting.Error(remoting.Error.Tag.NETWORK_FAILURE),
+ 'Failed to connect to ' + that.server_ + ': ' + error);
});
};
@@ -192,8 +193,9 @@ remoting.XmppConnection.prototype.onReceive_ = function(data) {
* @private
*/
remoting.XmppConnection.prototype.onReceiveError_ = function(errorCode) {
- this.onError_(remoting.Error.NETWORK_FAILURE,
- 'Failed to receive from XMPP socket: ' + errorCode);
+ this.onError_(
+ new remoting.Error(remoting.Error.Tag.NETWORK_FAILURE),
+ 'Failed to receive from XMPP socket: ' + errorCode);
};
/**
@@ -231,8 +233,9 @@ remoting.XmppConnection.prototype.flushSendQueue_ = function() {
})
.catch(function(/** number */ error) {
that.sendPending_ = false;
- that.onError_(remoting.Error.NETWORK_FAILURE,
- 'TCP write failed with error ' + error);
+ that.onError_(
+ new remoting.Error(remoting.Error.Tag.NETWORK_FAILURE),
+ 'TCP write failed with error ' + error);
});
};
@@ -279,8 +282,9 @@ remoting.XmppConnection.prototype.startTls_ = function() {
})
.catch(function(/** number */ error) {
that.startTlsPending_ = false;
- that.onError_(remoting.Error.NETWORK_FAILURE,
- 'Failed to start TLS: ' + error);
+ that.onError_(
+ new remoting.Error(remoting.Error.Tag.NETWORK_FAILURE),
+ 'Failed to start TLS: ' + error);
});
}
@@ -313,7 +317,7 @@ remoting.XmppConnection.prototype.onIncomingStanza_ = function(stanza) {
* @private
*/
remoting.XmppConnection.prototype.onParserError_ = function(text) {
- this.onError_(remoting.Error.UNEXPECTED, text);
+ this.onError_(remoting.Error.unexpected(), text);
}
/**
« no previous file with comments | « remoting/webapp/crd/js/wcs_loader.js ('k') | remoting/webapp/crd/js/xmpp_login_handler.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698