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

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

Issue 837113003: Fix host delete. Delete always returns a 204 (empty response), which will throw an "authentication … (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Merge Created 5 years, 11 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 | « remoting/webapp/app_remoting/js/app_remoting.js ('k') | remoting/webapp/crd/js/host_list_api_impl.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/webapp/crd/js/error.js
diff --git a/remoting/webapp/crd/js/error.js b/remoting/webapp/crd/js/error.js
index 6da496dff9bdcdd7004206798fdcfdcd4f2d3b59..137372f05125a38df72501c972db576ff5876ea7 100644
--- a/remoting/webapp/crd/js/error.js
+++ b/remoting/webapp/crd/js/error.js
@@ -36,21 +36,21 @@ remoting.Error = {
};
/**
- * @param {number} httpError An HTTP error code.
+ * @param {number} httpStatus An HTTP status code.
* @return {remoting.Error} The remoting.Error enum corresponding to the
- * specified HTTP error code.
+ * specified HTTP status code.
*/
-remoting.Error.fromHttpError = function(httpError) {
- if (httpError == 0) {
+remoting.Error.fromHttpStatus = function(httpStatus) {
+ if (httpStatus == 0) {
return remoting.Error.NETWORK_FAILURE;
- } else if (httpError == 200) {
+ } else if (httpStatus >= 200 && httpStatus < 300) {
return remoting.Error.NONE;
- } else if (httpError == 400 || httpError == 401) {
+ } else if (httpStatus == 400 || httpStatus == 401) {
return remoting.Error.AUTHENTICATION_FAILED;
- } else if (httpError >= 500 && httpError < 600) {
+ } else if (httpStatus >= 500 && httpStatus < 600) {
return remoting.Error.SERVICE_UNAVAILABLE;
} else {
- console.warn('Unexpected HTTP error code: ' + httpError);
+ console.warn('Unexpected HTTP error code: ' + httpStatus);
// Return AUTHENTICATION_FAILED by default, so that the user can try to
// recover from an unexpected failure by signing in again.
// TODO(jamiewalch): Return UNEXPECTED here and let calling code treat that
« no previous file with comments | « remoting/webapp/app_remoting/js/app_remoting.js ('k') | remoting/webapp/crd/js/host_list_api_impl.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698