| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 'use strict'; | 5 'use strict'; |
| 6 | 6 |
| 7 /** @suppress {duplicate} */ | 7 /** @suppress {duplicate} */ |
| 8 var remoting = remoting || {}; | 8 var remoting = remoting || {}; |
| 9 | 9 |
| 10 /** | 10 /** |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 remoting.Error.prototype.toConnectionError = function() { | 41 remoting.Error.prototype.toConnectionError = function() { |
| 42 var Tag = remoting.Error.Tag; | 42 var Tag = remoting.Error.Tag; |
| 43 var ConnectionError = remoting.ChromotingEvent.ConnectionError; | 43 var ConnectionError = remoting.ChromotingEvent.ConnectionError; |
| 44 switch (this.tag_) { | 44 switch (this.tag_) { |
| 45 case Tag.NONE: | 45 case Tag.NONE: |
| 46 return ConnectionError.NONE; | 46 return ConnectionError.NONE; |
| 47 case Tag.CLIENT_SUSPENDED: | 47 case Tag.CLIENT_SUSPENDED: |
| 48 return ConnectionError.CLIENT_SUSPENDED; | 48 return ConnectionError.CLIENT_SUSPENDED; |
| 49 case Tag.INVALID_ACCESS_CODE: | 49 case Tag.INVALID_ACCESS_CODE: |
| 50 return ConnectionError.INVALID_ACCESS_CODE; | 50 return ConnectionError.INVALID_ACCESS_CODE; |
| 51 case Tag.INVALID_ACCOUNT: |
| 52 return ConnectionError.INVALID_ACCOUNT; |
| 51 case Tag.MISSING_PLUGIN: | 53 case Tag.MISSING_PLUGIN: |
| 52 return ConnectionError.MISSING_PLUGIN; | 54 return ConnectionError.MISSING_PLUGIN; |
| 53 case Tag.AUTHENTICATION_FAILED: | 55 case Tag.AUTHENTICATION_FAILED: |
| 54 return ConnectionError.AUTHENTICATION_FAILED; | 56 return ConnectionError.AUTHENTICATION_FAILED; |
| 55 case Tag.HOST_IS_OFFLINE: | 57 case Tag.HOST_IS_OFFLINE: |
| 56 return ConnectionError.HOST_OFFLINE; | 58 return ConnectionError.HOST_OFFLINE; |
| 57 case Tag.INCOMPATIBLE_PROTOCOL: | 59 case Tag.INCOMPATIBLE_PROTOCOL: |
| 58 return ConnectionError.INCOMPATIBLE_PROTOCOL; | 60 return ConnectionError.INCOMPATIBLE_PROTOCOL; |
| 59 case Tag.BAD_VERSION: | 61 case Tag.BAD_VERSION: |
| 60 return ConnectionError.BAD_VERSION; | 62 return ConnectionError.BAD_VERSION; |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 // not normally cause the error text to be shown to the user, so the | 164 // not normally cause the error text to be shown to the user, so the |
| 163 // i18n-content prefix is not needed in this case. | 165 // i18n-content prefix is not needed in this case. |
| 164 CANCELLED: '__CANCELLED__', | 166 CANCELLED: '__CANCELLED__', |
| 165 | 167 |
| 166 // Used to signify that the local computer was suspended for long enough that | 168 // Used to signify that the local computer was suspended for long enough that |
| 167 // the connection is expected to drop, allowing a reconnect attempt to be | 169 // the connection is expected to drop, allowing a reconnect attempt to be |
| 168 // scheduled sooner. | 170 // scheduled sooner. |
| 169 CLIENT_SUSPENDED: /*i18n-content*/ 'ERROR_NETWORK_FAILURE', | 171 CLIENT_SUSPENDED: /*i18n-content*/ 'ERROR_NETWORK_FAILURE', |
| 170 | 172 |
| 171 INVALID_ACCESS_CODE: /*i18n-content*/ 'ERROR_INVALID_ACCESS_CODE', | 173 INVALID_ACCESS_CODE: /*i18n-content*/ 'ERROR_INVALID_ACCESS_CODE', |
| 174 INVALID_ACCOUNT: /*i18n-content*/ 'ERROR_INVALID_ACCOUNT', |
| 172 MISSING_PLUGIN: /*i18n-content*/ 'ERROR_MISSING_PLUGIN', | 175 MISSING_PLUGIN: /*i18n-content*/ 'ERROR_MISSING_PLUGIN', |
| 173 NACL_PLUGIN_CRASHED: /*i18n-content*/ 'ERROR_NACL_PLUGIN_CRASHED', | 176 NACL_PLUGIN_CRASHED: /*i18n-content*/ 'ERROR_NACL_PLUGIN_CRASHED', |
| 174 AUTHENTICATION_FAILED: /*i18n-content*/ 'ERROR_AUTHENTICATION_FAILED', | 177 AUTHENTICATION_FAILED: /*i18n-content*/ 'ERROR_AUTHENTICATION_FAILED', |
| 175 HOST_IS_OFFLINE: /*i18n-content*/ 'ERROR_HOST_IS_OFFLINE', | 178 HOST_IS_OFFLINE: /*i18n-content*/ 'ERROR_HOST_IS_OFFLINE', |
| 176 INCOMPATIBLE_PROTOCOL: /*i18n-content*/ 'ERROR_INCOMPATIBLE_PROTOCOL', | 179 INCOMPATIBLE_PROTOCOL: /*i18n-content*/ 'ERROR_INCOMPATIBLE_PROTOCOL', |
| 177 BAD_VERSION: /*i18n-content*/ 'ERROR_BAD_PLUGIN_VERSION', | 180 BAD_VERSION: /*i18n-content*/ 'ERROR_BAD_PLUGIN_VERSION', |
| 178 NETWORK_FAILURE: /*i18n-content*/ 'ERROR_NETWORK_FAILURE', | 181 NETWORK_FAILURE: /*i18n-content*/ 'ERROR_NETWORK_FAILURE', |
| 179 HOST_OVERLOAD: /*i18n-content*/ 'ERROR_HOST_OVERLOAD', | 182 HOST_OVERLOAD: /*i18n-content*/ 'ERROR_HOST_OVERLOAD', |
| 180 MAX_SESSION_LENGTH: /*i18n-content*/ 'ERROR_MAX_SESSION_LENGTH', | 183 MAX_SESSION_LENGTH: /*i18n-content*/ 'ERROR_MAX_SESSION_LENGTH', |
| 181 HOST_CONFIGURATION_ERROR: /*i18n-content*/ 'ERROR_HOST_CONFIGURATION_ERROR', | 184 HOST_CONFIGURATION_ERROR: /*i18n-content*/ 'ERROR_HOST_CONFIGURATION_ERROR', |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 232 remoting.Error.handler = function(onError) { | 235 remoting.Error.handler = function(onError) { |
| 233 return function(/** * */ error) { | 236 return function(/** * */ error) { |
| 234 if (error instanceof remoting.Error) { | 237 if (error instanceof remoting.Error) { |
| 235 onError(/** @type {!remoting.Error} */ (error)); | 238 onError(/** @type {!remoting.Error} */ (error)); |
| 236 } else { | 239 } else { |
| 237 console.error('Unexpected error:', error); | 240 console.error('Unexpected error:', error); |
| 238 onError(remoting.Error.unexpected()); | 241 onError(remoting.Error.unexpected()); |
| 239 } | 242 } |
| 240 }; | 243 }; |
| 241 }; | 244 }; |
| OLD | NEW |