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

Unified Diff: remoting/webapp/crd/js/host_controller.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/error.js ('k') | remoting/webapp/crd/js/host_daemon_facade.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/webapp/crd/js/host_controller.js
diff --git a/remoting/webapp/crd/js/host_controller.js b/remoting/webapp/crd/js/host_controller.js
index 38e159c4b822abf800868c5822843ebe11fbaae7..4779233dc3542364371feee1119df3b553ec8912 100644
--- a/remoting/webapp/crd/js/host_controller.js
+++ b/remoting/webapp/crd/js/host_controller.js
@@ -158,9 +158,9 @@ remoting.HostController.prototype.start = function(hostPin, consent, onDone,
remoting.hostList.onLocalHostStarted(hostName, newHostId, publicKey);
onDone();
} else if (result == remoting.HostController.AsyncResult.CANCELLED) {
- onStartError(remoting.Error.CANCELLED);
+ onStartError(new remoting.Error(remoting.Error.Tag.CANCELLED));
} else {
- onStartError(remoting.Error.UNEXPECTED);
+ onStartError(remoting.Error.unexpected());
}
}
@@ -262,7 +262,7 @@ remoting.HostController.prototype.start = function(hostPin, consent, onDone,
} else {
console.log('Failed to register the host. Status: ' + xhr.status +
' response: ' + xhr.responseText);
- onError(remoting.Error.REGISTRATION_FAILED);
+ onError(new remoting.Error(remoting.Error.Tag.REGISTRATION_FAILED));
}
}
@@ -374,9 +374,9 @@ remoting.HostController.prototype.stop = function(onDone, onError) {
if (result == remoting.HostController.AsyncResult.OK) {
that.getLocalHostId(unregisterHost);
} else if (result == remoting.HostController.AsyncResult.CANCELLED) {
- onError(remoting.Error.CANCELLED);
+ onError(new remoting.Error(remoting.Error.Tag.CANCELLED));
} else {
- onError(remoting.Error.UNEXPECTED);
+ onError(remoting.Error.unexpected());
}
}
@@ -411,9 +411,9 @@ remoting.HostController.prototype.updatePin = function(newPin, onDone,
if (result == remoting.HostController.AsyncResult.OK) {
onDone();
} else if (result == remoting.HostController.AsyncResult.CANCELLED) {
- onError(remoting.Error.CANCELLED);
+ onError(new remoting.Error(remoting.Error.Tag.CANCELLED));
} else {
- onError(remoting.Error.UNEXPECTED);
+ onError(remoting.Error.unexpected());
}
}
@@ -429,7 +429,7 @@ remoting.HostController.prototype.updatePin = function(newPin, onDone,
/** @param {Object} config */
function onConfig(config) {
if (!isHostConfigValid_(config)) {
- onError(remoting.Error.UNEXPECTED);
+ onError(remoting.Error.unexpected());
return;
}
/** @type {string} */
@@ -452,7 +452,7 @@ remoting.HostController.prototype.updatePin = function(newPin, onDone,
remoting.HostController.prototype.getLocalHostState = function(onDone) {
/** @param {!remoting.Error} error */
function onError(error) {
- onDone((error.tag == remoting.Error.Tag.MISSING_PLUGIN) ?
+ onDone((error.hasTag(remoting.Error.Tag.MISSING_PLUGIN)) ?
remoting.HostController.State.NOT_INSTALLED :
remoting.HostController.State.UNKNOWN);
}
« no previous file with comments | « remoting/webapp/crd/js/error.js ('k') | remoting/webapp/crd/js/host_daemon_facade.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698