[aspectc-user] Throw exception
daniel.lohmann at informatik.uni-erlangen.de
Tue Feb 19 09:14:28 CET 2008
On 18.02.2008, at 11:00, Dima S wrote:
> Hello all,
> I want to have a pointcut for throwing C++ exception.
> I have the following code:
> class MyExc
> class bobo
> int bobo::bla( int d )
> if( d == 0 )
> throw MyExc();
> return d * d;
> I define the following pointcut:
> pointcut exception() = call( "%throw%" );
> and corresponding advice:
> advice exception(): before ()
> printf( "\tException is thrown here!");
> However it does not work.
> Any idea what i should do to get correct advice/pointcut?
AspectC++ currently does not support giving advice to throw statements.
If the code throwing the exceptions is under your control, you might
consider delegating the throw to an extra (inline)-function and give
advice to this function.
More information about the aspectc-user