zhongjiajie commented on code in PR #10792:
URL: https://github.com/apache/dolphinscheduler/pull/10792#discussion_r915654998
##########
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/exceptions/ApiExceptionHandler.java:
##########
@@ -36,6 +36,12 @@ public class ApiExceptionHandler {
private static final Logger logger =
LoggerFactory.getLogger(ApiExceptionHandler.class);
+ @ExceptionHandler(ServiceException.class)
+ public Result exceptionHandler(ServiceException e, HandlerMethod hm) {
+ logger.error("ServiceException: ", e);
+ return new Result(e.getCode(), e.getMessage());
+ }
Review Comment:
I add a new handler to handle Service Exception throw from service side,
according to @caishunfeng suggetion. So we can throw exception in service side,
and keep our code clear
--
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]