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 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
186 SERVICE_UNAVAILABLE: /*i18n-content*/ 'ERROR_SERVICE_UNAVAILABLE', | 186 SERVICE_UNAVAILABLE: /*i18n-content*/ 'ERROR_SERVICE_UNAVAILABLE', |
187 NOT_AUTHENTICATED: /*i18n-content*/ 'ERROR_NOT_AUTHENTICATED', | 187 NOT_AUTHENTICATED: /*i18n-content*/ 'ERROR_NOT_AUTHENTICATED', |
188 NOT_FOUND: /*i18n-content*/ 'ERROR_NOT_FOUND', | 188 NOT_FOUND: /*i18n-content*/ 'ERROR_NOT_FOUND', |
189 INVALID_HOST_DOMAIN: /*i18n-content*/ 'ERROR_INVALID_HOST_DOMAIN', | 189 INVALID_HOST_DOMAIN: /*i18n-content*/ 'ERROR_INVALID_HOST_DOMAIN', |
190 P2P_FAILURE: /*i18n-content*/ 'ERROR_P2P_FAILURE', | 190 P2P_FAILURE: /*i18n-content*/ 'ERROR_P2P_FAILURE', |
191 REGISTRATION_FAILED: /*i18n-content*/ 'ERROR_HOST_REGISTRATION_FAILED', | 191 REGISTRATION_FAILED: /*i18n-content*/ 'ERROR_HOST_REGISTRATION_FAILED', |
192 NOT_AUTHORIZED: /*i18n-content*/ 'ERROR_NOT_AUTHORIZED', | 192 NOT_AUTHORIZED: /*i18n-content*/ 'ERROR_NOT_AUTHORIZED', |
193 // TODO(garykac): Move app-specific errors into separate location. | 193 // TODO(garykac): Move app-specific errors into separate location. |
194 APP_NOT_AUTHORIZED: /*i18n-content*/ 'ERROR_APP_NOT_AUTHORIZED', | 194 APP_NOT_AUTHORIZED: /*i18n-content*/ 'ERROR_APP_NOT_AUTHORIZED', |
195 NACL_DISABLED: /*i18n-content*/ 'ERROR_NACL_DISABLED', | 195 NACL_DISABLED: /*i18n-content*/ 'ERROR_NACL_DISABLED', |
| 196 POLICY_ERROR: /*i18n-content*/ 'ERROR_POLICY', |
196 }; | 197 }; |
197 | 198 |
198 // A whole bunch of semi-redundant constants, mostly to reduce to size | 199 // A whole bunch of semi-redundant constants, mostly to reduce to size |
199 // of the diff that introduced the remoting.Error class. | 200 // of the diff that introduced the remoting.Error class. |
200 // | 201 // |
201 // Please don't add any more constants here; just call the | 202 // Please don't add any more constants here; just call the |
202 // remoting.Error constructor directly | 203 // remoting.Error constructor directly |
203 | 204 |
204 /** | 205 /** |
205 * @param {number} httpStatus An HTTP status code. | 206 * @param {number} httpStatus An HTTP status code. |
(...skipping 29 matching lines...) Expand all Loading... |
235 remoting.Error.handler = function(onError) { | 236 remoting.Error.handler = function(onError) { |
236 return function(/** * */ error) { | 237 return function(/** * */ error) { |
237 if (error instanceof remoting.Error) { | 238 if (error instanceof remoting.Error) { |
238 onError(/** @type {!remoting.Error} */ (error)); | 239 onError(/** @type {!remoting.Error} */ (error)); |
239 } else { | 240 } else { |
240 console.error('Unexpected error:', error); | 241 console.error('Unexpected error:', error); |
241 onError(remoting.Error.unexpected()); | 242 onError(remoting.Error.unexpected()); |
242 } | 243 } |
243 }; | 244 }; |
244 }; | 245 }; |
OLD | NEW |