[aspectwerkz-user] After throwing advice
Wirama Putra <[email protected]>
| Newsgroups | gmane.comp.java.aspectwerkz.user |
|---|---|
| Message-ID | <[email protected]> |
Hi, I want to wrap runtime exception that is thrown from execution of method of Services or Repositories. For that, I declare the following aspect: --- <aspect class="com.revtech.framework.aop.ThrowsAspect"> <pointcut name="publicServiceAndRepository" expression="execution(public * com.revtech.framework.service.Service+.*(..)) OR execution(public * com.revtech.framework.repository.Repository+.*(..))"/> <advice name="afterThrowing" type="after throwing(java.lang.RuntimeException)" bind-to="publicServiceAndRepository"/> </aspect> --- Method afterThrowing has the following signature: --- public void afterThrowing(JoinPoint jp) throws Throwable --- The problem is: In the afterThrowing method I need the exception that was thrown. I can't find any way to get it. I can't even know the object (instance of service / repository) that was invoked :( Is there something like ThrowsAdvice in Springframework? It's a simple matter in Spring to have access to such information... I only have to have implement method with the following signature in my advice (which implements ThrowsAdvice): --- afterThrowing([Method], [args], [target], Throwable subclass) --- I see that there's an interface named AfterThrowingAdvice in AspectWerkz 2.0. But it's not clear to me how to use it. Best regards & TIA, Raka (http://www.jroller.com/page/donraka) __________________________________ Do you Yahoo!? Yahoo! Small Business - Try our new resources site! http://smallbusiness.yahoo.com/resources/