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

Side by Side Diff: remoting/webapp/crd/js/xhr.js

Issue 1004513002: Eliminated named constants for instances of remoting.Error. (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 unified diff | Download patch
« no previous file with comments | « remoting/webapp/crd/js/wcs_loader.js ('k') | remoting/webapp/crd/js/xmpp_connection.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 /** 5 /**
6 * @fileoverview 6 * @fileoverview
7 * Simple utilities for making XHRs more pleasant. 7 * Simple utilities for making XHRs more pleasant.
8 */ 8 */
9 9
10 'use strict'; 10 'use strict';
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 * @param {function():void} onDone 201 * @param {function():void} onDone
202 * @param {function(!remoting.Error):void} onError 202 * @param {function(!remoting.Error):void} onError
203 * @param {Array<remoting.Error.Tag>=} opt_ignoreErrors 203 * @param {Array<remoting.Error.Tag>=} opt_ignoreErrors
204 * @return {function(XMLHttpRequest):void} 204 * @return {function(XMLHttpRequest):void}
205 */ 205 */
206 remoting.xhr.defaultResponse = function(onDone, onError, opt_ignoreErrors) { 206 remoting.xhr.defaultResponse = function(onDone, onError, opt_ignoreErrors) {
207 /** @param {XMLHttpRequest} xhr */ 207 /** @param {XMLHttpRequest} xhr */
208 var result = function(xhr) { 208 var result = function(xhr) {
209 var error = 209 var error =
210 remoting.Error.fromHttpStatus(/** @type {number} */ (xhr.status)); 210 remoting.Error.fromHttpStatus(/** @type {number} */ (xhr.status));
211 if (!error.isError()) { 211 if (error.isNone()) {
212 onDone(); 212 onDone();
213 return; 213 return;
214 } 214 }
215 215
216 if (opt_ignoreErrors && opt_ignoreErrors.indexOf(error.tag) !== -1) { 216 if (opt_ignoreErrors && error.hasTag.apply(error, opt_ignoreErrors)) {
217 onDone(); 217 onDone();
218 return; 218 return;
219 } 219 }
220 220
221 onError(error); 221 onError(error);
222 }; 222 };
223 return result; 223 return result;
224 }; 224 };
OLDNEW
« no previous file with comments | « remoting/webapp/crd/js/wcs_loader.js ('k') | remoting/webapp/crd/js/xmpp_connection.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698