blibli-future / athens

0 stars 1 forks source link

Add ControllerAdvice #30

Closed riencus closed 7 years ago

riencus commented 7 years ago

In this PR I introduced a new class which annotated with @RestControllerAdvice named AthensControllerAdvice.

This class will catch all exception thrown by controller and return a specified response.

Pros:

aamesaa commented 7 years ago

since we only have about 2 weeks to finish the entire project, do we have enough time to refactor all service?

riencus commented 7 years ago

Well, We can do it partially though. Refactor only the service that we are working on at that time. Adding this class won't break the system. Like what I said in the PR notes, a Controller advice will catch the exception thrown by a controller. If there's no controller that throws any exception, it will never be called.

Another Pros that I forgot to mention, it gives swagger-ui a better response documentation.