| 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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 */ | 47 */ |
| 48 remoting.Error.prototype.getDetail = function() { | 48 remoting.Error.prototype.getDetail = function() { |
| 49 return this.detail_; | 49 return this.detail_; |
| 50 }; | 50 }; |
| 51 | 51 |
| 52 /** | 52 /** |
| 53 * Checks the type of an error. | 53 * Checks the type of an error. |
| 54 * @param {remoting.Error.Tag} tag | 54 * @param {remoting.Error.Tag} tag |
| 55 * @param {...remoting.Error.Tag} var_args | 55 * @param {...remoting.Error.Tag} var_args |
| 56 * @return {boolean} True if this object has one of the specified tags. | 56 * @return {boolean} True if this object has one of the specified tags. |
| 57 * @suppress {reportUnknownTypes} |
| 57 */ | 58 */ |
| 58 remoting.Error.prototype.hasTag = function(tag, var_args) { | 59 remoting.Error.prototype.hasTag = function(tag, var_args) { |
| 59 var thisTag = this.tag_; | 60 var thisTag = this.tag_; |
| 60 return Array.prototype.some.call( | 61 return Array.prototype.some.call( |
| 61 arguments, | 62 arguments, |
| 62 function(/** remoting.Error.Tag */ tag) { | 63 function(/** remoting.Error.Tag */ tag) { |
| 63 return thisTag == tag; | 64 return thisTag == tag; |
| 64 }); | 65 }); |
| 65 }; | 66 }; |
| 66 | 67 |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 165 remoting.Error.handler = function(onError) { | 166 remoting.Error.handler = function(onError) { |
| 166 return function(/** * */ error) { | 167 return function(/** * */ error) { |
| 167 if (error instanceof remoting.Error) { | 168 if (error instanceof remoting.Error) { |
| 168 onError(/** @type {!remoting.Error} */ (error)); | 169 onError(/** @type {!remoting.Error} */ (error)); |
| 169 } else { | 170 } else { |
| 170 console.error('Unexpected error:', error); | 171 console.error('Unexpected error:', error); |
| 171 onError(remoting.Error.unexpected()); | 172 onError(remoting.Error.unexpected()); |
| 172 } | 173 } |
| 173 }; | 174 }; |
| 174 }; | 175 }; |
| OLD | NEW |