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

Unified Diff: remoting/webapp/crd/js/desktop_remoting.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: Smaller diff. Created 5 years, 10 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
Index: remoting/webapp/crd/js/desktop_remoting.js
diff --git a/remoting/webapp/crd/js/desktop_remoting.js b/remoting/webapp/crd/js/desktop_remoting.js
index a1838d42c8bc4282cd440662a91687c1bd203b27..d643eec92034562fa2d28b2551a206f48daf8fe2 100644
--- a/remoting/webapp/crd/js/desktop_remoting.js
+++ b/remoting/webapp/crd/js/desktop_remoting.js
@@ -239,7 +239,7 @@ remoting.DesktopRemoting.prototype.handleDisconnected = function() {
* Called when the current session's connection has failed.
*
* @param {remoting.SessionConnector} connector
- * @param {remoting.Error} error
+ * @param {!remoting.Error} error
* @return {void} Nothing.
*/
remoting.DesktopRemoting.prototype.handleConnectionFailed = function(
@@ -259,7 +259,7 @@ remoting.DesktopRemoting.prototype.handleConnectionFailed = function(
that.handleError(error);
};
- if (error == remoting.Error.HOST_IS_OFFLINE &&
+ if (error.tag == remoting.Error.Tag.HOST_IS_OFFLINE &&
that.refreshHostJidIfOffline_) {
that.refreshHostJidIfOffline_ = false;
// The plugin will be re-created when the host finished refreshing
@@ -291,14 +291,14 @@ remoting.DesktopRemoting.prototype.handleExtensionMessage = function(
/**
* Called when an error needs to be displayed to the user.
*
- * @param {remoting.Error} errorTag The error to be localized and displayed.
+ * @param {!remoting.Error} error The error to be localized and displayed.
* @return {void} Nothing.
*/
-remoting.DesktopRemoting.prototype.handleError = function(errorTag) {
- console.error('Connection failed: ' + errorTag);
+remoting.DesktopRemoting.prototype.handleError = function(error) {
+ console.error('Connection failed: %o', error);
Jamie 2015/02/26 18:57:42 IMO, the %o syntax is less clear than using "+". I
John Williams 2015/02/27 21:42:11 If `error` is an object, using %o lets you browse
Jamie 2015/03/02 18:28:09 In that case, you can achieve the same effect with
John Williams 2015/03/02 22:01:36 Done.
remoting.accessCode = '';
- if (errorTag === remoting.Error.AUTHENTICATION_FAILED) {
+ if (error.tag === remoting.Error.Tag.AUTHENTICATION_FAILED) {
remoting.setMode(remoting.AppMode.HOME);
remoting.handleAuthFailureAndRelaunch();
return;
@@ -308,7 +308,7 @@ remoting.DesktopRemoting.prototype.handleError = function(errorTag) {
this.refreshHostJidIfOffline_ = true;
var errorDiv = document.getElementById('connect-error-message');
- l10n.localizeElementFromTag(errorDiv, /** @type {string} */ (errorTag));
+ l10n.localizeElementFromTag(errorDiv, error.tag);
var mode = remoting.clientSession ? remoting.desktopConnectedView.getMode()
: this.app_.getSessionConnector().getConnectionMode();

Powered by Google App Engine
This is Rietveld 408576698