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

Unified Diff: remoting/webapp/crd/js/xhr.js

Issue 1039853002: Added isError method to remoting.Xhr.Error to check for HTTP errors. (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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | remoting/webapp/crd/js/xhr_unittest.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/webapp/crd/js/xhr.js
diff --git a/remoting/webapp/crd/js/xhr.js b/remoting/webapp/crd/js/xhr.js
index cc50b27745e4fce258f1715982795f436b6dd915..4b3603e7b5e913693f9642f53f5a95e8fee005f5 100644
--- a/remoting/webapp/crd/js/xhr.js
+++ b/remoting/webapp/crd/js/xhr.js
@@ -294,6 +294,14 @@ remoting.Xhr.Response = function(xhr, allowJson) {
};
/**
+ * @return {boolean} True if the response code is outside the 200-299
+ * range (i.e. success as defined by the HTTP protocol).
+ */
+remoting.Xhr.Response.prototype.isError = function() {
+ return this.status < 200 || this.status >= 300;
+};
+
+/**
* @return {string} The text content of the response.
*/
remoting.Xhr.Response.prototype.getText = function() {
« no previous file with comments | « no previous file | remoting/webapp/crd/js/xhr_unittest.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698