You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dolphinscheduler.apache.org by "njnu-seafish (via GitHub)" <gi...@apache.org> on 2026/03/03 02:39:18 UTC

Re: [PR] [Improvement-17960][API]Add null/empty/duplicate validation logic for globalParams when creating or updating a workflow [dolphinscheduler]

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: commits-unsubscribe@dolphinscheduler.apache.org

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