Procházet zdrojové kódy

HUE-4198 [metastore] Sample fetch breaks the page when it fails with error 1

Johan Ahlen před 9 roky
rodič
revize
26989ac

+ 1 - 2
desktop/core/src/desktop/static/desktop/js/apiHelper.js

@@ -134,8 +134,7 @@
   ApiHelper.prototype.successResponseIsError = function (response) {
     return typeof response !== 'undefined' && (
         typeof response.traceback !== 'undefined' ||
-        (typeof response.status !== 'undefined' && response.status < 0) ||
-        response.status === 500 ||
+        (typeof response.status !== 'undefined' && response.status !== 0) ||
         response.code === 503 ||
         response.code === 500);
   };

+ 4 - 0
desktop/core/src/desktop/static/desktop/spec/apiHelperSpec.js

@@ -34,6 +34,10 @@ define([
         expect(subject.successResponseIsError({ status: 0 })).toBeFalsy();
       });
 
+      it("should determine that a success response is an error response if status is 1", function () {
+        expect(subject.successResponseIsError({ status: 1 })).toBeTruthy();
+      });
+
       it("should determine that a success response is an error response if status is -1", function () {
         expect(subject.successResponseIsError({ status: -1 })).toBeTruthy();
       });