njnu-seafish commented on code in PR #17961:
URL: 
https://github.com/apache/dolphinscheduler/pull/17961#discussion_r2875719811


##########
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/WorkflowDefinitionServiceImpl.java:
##########
@@ -291,6 +292,15 @@ public Map<String, Object> createWorkflowDefinition(User 
loginUser,
                     definition.getName(), definition.getCode());
             throw new ServiceException(Status.WORKFLOW_DEFINITION_NAME_EXIST, 
name);
         }
+
+        try {
+            validateGlobalParams(globalParams);
+        } catch (ServiceException ex) {
+            log.warn("Invalid globalParams: {}", ex.getMessage());
+            putMsg(result, Status.REQUEST_PARAMS_NOT_VALID_ERROR, 
ex.getMessage());
+            return result;
+        }

Review Comment:
   > Suggested change
   >         try {
   >             validateGlobalParams(globalParams);
   >         } catch (ServiceException ex) {
   >             log.warn("Invalid globalParams: {}", ex.getMessage());
   >             putMsg(result, Status.REQUEST_PARAMS_NOT_VALID_ERROR, 
ex.getMessage());
   >             return result;
   >         }
   >             validateGlobalParams(globalParams);
   > Directly throw `ServiceException` at `validateGlobalParams`, please don't 
use a lot of try catch here.
   
   ok



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to