[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [aspectj-users] Catch with AspectJ
|
I think is good idea use throws any methods your project after use AspectJ for capture this possible Exceptions for Example:
public class A
{
public void doSomething() throws Exception
{
}
}
public Aspect ExceptionTrace
{
pointcut traceException(): execution(* A.*(..));
after() throwing(Exception ex) :traceException()
{
System.out.println("Exception:");
ex.printStackTrace();
}
}
On 7/31/07,
Bora Erbas <bora.erbas@xxxxxxxxx> wrote:
Maybe you can use "throws" pcd which might be useful in that case. But
AFAIK, it captures if the method -throws- an exception not -catches-
it. Hence you might need to remove the exception handling code from
the original method and handle it using aspectj.
On 7/31/07, Filipe Costa <filipe.fgcosta@xxxxxxxxx> wrote:
> Hi
>
> I'm starting with AspectJ and I have a lot of packages and in which them
> java classes. I want to do an aspect that capture every exceptions and do
> something like that:
>
> logger.logp(Level.SEVERE, <class name>.class.getName(), "method name",
>
e.getMessage());
>
> Because every exceptions has a same kind of catch, lake that:
>
> (…)
> catch(<something>Exception e)
> {
> logger.logp(Level.SEVERE
, <class name>.class.getName(),
> "method name", e.getMessage());
> }
>
> Can someone give me an idea?
>
> thank you
>
> fg_costa
>
> _______________________________________________
> aspectj-users mailing list
> aspectj-users@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/aspectj-users
>
>
_______________________________________________
aspectj-users mailing list
aspectj-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/aspectj-users
--
raphael milani
:=]