You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dolphinscheduler.apache.org by GitBox <gi...@apache.org> on 2022/08/03 09:10:11 UTC

[GitHub] [dolphinscheduler] CalvinKirs commented on issue #11278: [Improvement][API] Change the way exceptions are handled in the API

CalvinKirs commented on issue #11278:
URL: https://github.com/apache/dolphinscheduler/issues/11278#issuecomment-1203689006

   > > I think `putMsg` and `Exception` are two different behaviors. We use `putMsg` to return valid error messages through API, while exceptions will not be returned through API.
   > 
   > I have discuss with @caishunfeng , we think `putMsg` it is redundant and we should throw exception directly in serviceImpl, So we add a new `ExceptionHandler` in
   > 
   > https://github.com/apache/dolphinscheduler/blob/ae6aa53f963d2ea02ab435db1e5548da23e3f882/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/exceptions/ApiExceptionHandler.java#L39-L43
   > 
   > from api side, which will covert the `ServiceException` to `Result` object, and return in `controller`. And we already have some existing code in
   > https://github.com/apache/dolphinscheduler/blob/ae6aa53f963d2ea02ab435db1e5548da23e3f882/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/TenantServiceImpl.java#L94-L105
   > 
   > And @SbloodyS do you think it is a good idea about this change? @SbloodyS
   
   +1, make sense to me, `Result` is usually only used as a standard data format for external system interaction.


-- 
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