You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@gobblin.apache.org by GitBox <gi...@apache.org> on 2022/07/20 07:20:18 UTC

[GitHub] [gobblin] phet commented on a diff in pull request #3516: [GOBBLIN-1656] Return a http status 503 on GaaS when quota is exceeded for user or flowgroup

phet commented on code in PR #3516:
URL: https://github.com/apache/gobblin/pull/3516#discussion_r925256213


##########
gobblin-restli/gobblin-flow-config-service/gobblin-flow-config-service-server/src/main/java/org/apache/gobblin/service/FlowConfigV2ResourceLocalHandler.java:
##########
@@ -83,11 +83,10 @@ public CreateKVResponse createFlowConfig(FlowConfig flowConfig, boolean triggerL
     Map<String, AddSpecResponse> responseMap = new HashMap<>();
     try {
       responseMap = this.flowCatalog.put(flowSpec, triggerListener);
-    } catch (Throwable e) {
-      // TODO: Compilation errors should fall under throwable exceptions as well instead of checking for strings
-      if (e instanceof QuotaExceededException) {
+    } catch (QuotaExceededException e) {
         throw new RestLiServiceException(HttpStatus.S_503_SERVICE_UNAVAILABLE, e.getMessage());
-      }
+      } catch (Throwable e) {

Review Comment:
   again



##########
gobblin-restli/gobblin-flow-config-service/gobblin-flow-config-service-server/src/main/java/org/apache/gobblin/service/FlowConfigResourceLocalHandler.java:
##########
@@ -136,10 +136,10 @@ public CreateResponse createFlowConfig(FlowConfig flowConfig, boolean triggerLis
     } else {
       try {
         this.flowCatalog.put(flowSpec, triggerListener);
+      } catch (QuotaExceededException e) {
+        throw new RestLiServiceException(HttpStatus.S_503_SERVICE_UNAVAILABLE, e.getMessage());
       } catch (Throwable e) {
-        if (e instanceof QuotaExceededException) {
-          throw new RestLiServiceException(HttpStatus.S_503_SERVICE_UNAVAILABLE, e.getMessage());
-        }
+        // TODO: Compilation errors should fall under throwable exceptions as well instead of checking for strings

Review Comment:
   I realize this is just a request handler, so not hugely consequential to catch *all exceptions*, but please at least just log whatever you find here, so it's not a silent/squelched failure we have a hard time determining to be happening one future day.



##########
gobblin-restli/gobblin-flow-config-service/gobblin-flow-config-service-server/src/main/java/org/apache/gobblin/service/FlowConfigResourceLocalHandler.java:
##########
@@ -177,10 +177,10 @@ public UpdateResponse updateFlowConfig(FlowId flowId, FlowConfig flowConfig, boo
     }
     try {
       this.flowCatalog.put(createFlowSpecForConfig(flowConfig), triggerListener);
+    } catch (QuotaExceededException e) {
+      throw new RestLiServiceException(HttpStatus.S_503_SERVICE_UNAVAILABLE, e.getMessage());
     } catch (Throwable e) {
-      if (e instanceof QuotaExceededException) {
-        throw new RestLiServiceException(HttpStatus.S_503_SERVICE_UNAVAILABLE, e.getMessage());
-      }
+      // TODO: Compilation errors should fall under throwable exceptions as well instead of checking for strings

Review Comment:
   same here



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@gobblin.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org