how to pointcut to my custom throwable class which extends Exception class? (@aspect)

54 views Asked by At

I have custom SubscriberNotFoundException class which extends Exception class. I want to pointcut its some methods using aspects for catching exceptions and logging to file.

Here is my code:

    try {
          --------
        } 
        catch (SubscriberNotFoundException e) 
        { 
            return ResponseEntity.status(HttpStatus.BAD_REQUEST)
            .body(new Response(e.getCode(),  e.getMessage(), null));
        }

my custom class:

@ToString
@Getter   
public class SubscriberNotFoundException extends Exception {

    ------
}

The problem is that pointcut cannot handle this methods of SubscriberNotFoundException class.

I have tryed all case of pointcut syntax, for example

@Pointcut("within(com.xyz.someapp.web..*)")
@Pointcut("execution(* com.xyz.someapp.service.*.*(..))")

and others, so i think that's not the problem.

0

There are 0 answers