zhongjiajie commented on PR #11782: URL: https://github.com/apache/dolphinscheduler/pull/11782#issuecomment-1250070741
> I do not think this is a good idea, we should directly throw error instead of print log, and actually I already throw error in #11912 We already have `ExceptionHandler`accept `ServiceException` and package `ServiceException` code and message into `Result` object, and it uses in the controller layer https://github.com/apache/dolphinscheduler/blob/ae6aa53f963d2ea02ab435db1e5548da23e3f882/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/exceptions/ApiExceptionHandler.java#L39-L43 so when we throw an exception in the service layer, we will catch it in the controller layer and return the new `Result` object. And we already have exists method in https://github.com/apache/dolphinscheduler/blob/d3a77c68e62b0c471e25cd6a4bfbd2c561dd2023/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessInstanceServiceImpl.java#L657-L659. when exception throw in L658 https://github.com/apache/dolphinscheduler/blob/d3a77c68e62b0c471e25cd6a4bfbd2c561dd2023/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessInstanceServiceImpl.java#L658 controller will catch it and package into `Result(code=Status.PROCESS_INSTANCE_STATE_OPERATION_ERROR.getCode(), message=Status.PROCESS_INSTANCE_STATE_OPERATION_ERROR.getMsg())` -- 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]
