瀏覽代碼

HUE-4164 [editor] The ApiHelper should treat any negative status in the response as an error

Johan Ahlen 9 年之前
父節點
當前提交
5a67846573

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

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

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

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