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

Unified Diff: remoting/webapp/crd/js/client_session.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/browser_test/mock_identity.js ('k') | remoting/webapp/crd/js/crd_connect.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/webapp/crd/js/client_session.js
diff --git a/remoting/webapp/crd/js/client_session.js b/remoting/webapp/crd/js/client_session.js
index 4f4b8e39a23020cf5cf4f25d08d7f0046e562719..e397d3edac25de77ad08adf3dfd833920b388292 100644
--- a/remoting/webapp/crd/js/client_session.js
+++ b/remoting/webapp/crd/js/client_session.js
@@ -46,7 +46,7 @@ remoting.ClientSession = function(plugin, host, signalStrategy, mode) {
this.state_ = remoting.ClientSession.State.CREATED;
/** @private {!remoting.Error} */
- this.error_ = remoting.Error.NONE;
+ this.error_ = remoting.Error.none();
/** @private */
this.host_ = host;
@@ -255,7 +255,7 @@ remoting.ClientSession.prototype.removePlugin = function() {
* dispose() to remove and destroy the <embed> element.
*
* @param {!remoting.Error} error The reason for the disconnection. Use
- * remoting.Error.NONE if there is no error.
+ * remoting.Error.none() if there is no error.
* @return {void} Nothing.
*/
remoting.ClientSession.prototype.disconnect = function(error) {
@@ -395,22 +395,27 @@ remoting.ClientSession.prototype.onConnectionStatusUpdate =
} else if (status == remoting.ClientSession.State.FAILED) {
switch (error) {
case remoting.ClientSession.ConnectionError.HOST_IS_OFFLINE:
- this.error_ = remoting.Error.HOST_IS_OFFLINE;
+ this.error_ = new remoting.Error(
+ remoting.Error.Tag.HOST_IS_OFFLINE);
break;
case remoting.ClientSession.ConnectionError.SESSION_REJECTED:
- this.error_ = remoting.Error.INVALID_ACCESS_CODE;
+ this.error_ = new remoting.Error(
+ remoting.Error.Tag.INVALID_ACCESS_CODE);
break;
case remoting.ClientSession.ConnectionError.INCOMPATIBLE_PROTOCOL:
- this.error_ = remoting.Error.INCOMPATIBLE_PROTOCOL;
+ this.error_ = new remoting.Error(
+ remoting.Error.Tag.INCOMPATIBLE_PROTOCOL);
break;
case remoting.ClientSession.ConnectionError.NETWORK_FAILURE:
- this.error_ = remoting.Error.P2P_FAILURE;
+ this.error_ = new remoting.Error(
+ remoting.Error.Tag.P2P_FAILURE);
break;
case remoting.ClientSession.ConnectionError.HOST_OVERLOAD:
- this.error_ = remoting.Error.HOST_OVERLOAD;
+ this.error_ = new remoting.Error(
+ remoting.Error.Tag.HOST_OVERLOAD);
break;
default:
- this.error_ = remoting.Error.UNEXPECTED;
+ this.error_ = remoting.Error.unexpected();
}
}
this.setState_(status);
@@ -492,7 +497,7 @@ remoting.ClientSession.prototype.setState_ = function(newState) {
if (this.state_ == remoting.ClientSession.State.CLOSED) {
state = remoting.ClientSession.State.CONNECTION_CANCELED;
} else if (this.state_ == remoting.ClientSession.State.FAILED &&
- this.error_.tag == remoting.Error.Tag.HOST_IS_OFFLINE &&
+ this.error_.hasTag(remoting.Error.Tag.HOST_IS_OFFLINE) &&
!this.logHostOfflineErrors_) {
// The application requested host-offline errors to be suppressed, for
// example, because this connection attempt is using a cached host JID.
« no previous file with comments | « remoting/webapp/browser_test/mock_identity.js ('k') | remoting/webapp/crd/js/crd_connect.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698