Dans AspectJ, je veux avaler une exception.Comment avaler une exception à AfterThrowing dans AspectJ
@Aspect
public class TestAspect {
@Pointcut("execution(public * *Throwable(..))")
void throwableMethod() {}
@AfterThrowing(pointcut = "throwableMethod()", throwing = "e")
public void swallowThrowable(Throwable e) throws Exception {
logger.debug(e.toString());
}
}
public class TestClass {
public void testThrowable() {
throw new Exception();
}
}
Au-dessus, il n'a pas avalé l'exception. L'appelant de testThrowable() a toujours reçu l'exception. Je veux que l'appelant ne reçoive pas d'exception. Comment peut-on faire ça? Merci.
Merci à Tadeusz! J'ai résolu! – user389227