title: How to intercept exception thrown from aspect in spring aop
body: <p>Is there any way to intercept exception and show meaningful message to end customer? I am trying to authorise my api using spring AOP and if end user is not authorised to access the API, I am throwing exception.</p>
  
  <pre><code>@Aspect
  public class AuthorizationAspect {
    @Pointcut("@annotation(AuthenticateAccount)")
      public void authorized() {}
  
     private boolean isAuthorized() {
     // logic to check is user is authorised to call the api
     }
  
      @Before("authorized()")
      public void beforeControllerCall(JoinPoint joinPoint) throws UnauthorizedException {
  
          if(!isAuthorized)) {
              throw new UnauthorizedException("You don't have rights over this API");
          }
  
      }
  }
  </code></pre>
  
  <p>By throwing the exception, I am able to prevent the acess to API, but it does not return me meaningful message which I am trying to throw in exception.</p>
  
  <p>Has anyone worked with such use case and can help me with this?</p>