PDA

View Full Version : ThrowsAdviceInterceptor: At least one handler method must be


mruanova
05-12-2006, 06:40 PM
am using this advices with no problem: ConsoleLoggingBeforeAdvice, ConsoleLoggingAfterAdvice, ConsoleLoggingAroundAdvice.

But I have problems with ConsoleLoggingThrowsAdvice. I confess that the simple scenario works, but I am doing some complex scenarios and i got the next exception message, hope that someboy could help, thanks a lot.

------ Test started: Assembly: UnitTests.dll ------

TestCase UnitTests.FactoryBaseTest.Create_Advices' failed:
System.ArgumentException:
At least one handler method must be found in class
[Spring.Aop.DynamicProxy.Proxy_d69022928714448cb72 e 7c1b340a4a30].
at Spring.Aop.Framework.Adapter.ThrowsAdviceIntercept or..ctor(Object advice)
at Spring.Aop.Framework.Adapter.ThrowsAdviceAdapter.G etInterceptor(IAdvisor advisor)
at Spring.Aop.Framework.Adapter.DefaultAdvisorAdapter Registry.GetInterceptor(IAdvisor advisor)
at Spring.Aop.Framework.AdvisorChainFactoryUtils.Calc ulateInterceptors(IAdvised config, Object proxy, MethodInfo method, Type targetType)
at Spring.Aop.Framework.HashtableCachingAdvisorChainF actory.GetInterceptors(IAdvised advised, Object proxy, String methodId, MethodInfo method, Type targetType)
at Spring.Aop.Framework.DynamicProxy.BaseCompositionP roxy.GetInterceptors(Type targetType, String methodId, MethodInfo method)
at Spring.Aop.DynamicProxy.Proxy_a1bf817697604fd0a002 46ce40cb7a28.Print(String message)
c:\unittests\factorybasetest.cs(123,0): at UnitTests.FactoryBaseTest.Create_Advices()

0 passed, 1 failed, 0 skipped, took 2.13 seconds.

mruanova
05-12-2006, 06:40 PM
public class ConsoleLoggingThrowsAdvice : IThrowsAdvice
{
public void AfterThrowing(Exception ex)
{
Console.Out.WriteLine("* CONSOLE LOGGING : THROWS ADVICE");
Console.Out.WriteLine("Advised method threw this exception : " + ex);
}
}

mruanova
05-12-2006, 06:41 PM
my class that i want to have advices is called SampleBO, and has this method

public void Print(string message)
{
try
{
Console.WriteLine(message);
}
catch(Exception)
{
throw;
}
}

i want an advice in the after throwing

Bruno Baia
05-13-2006, 10:26 AM
Hi,

Can u copy/paste your xml configuration or the code that u use for weaving your aspects.

-Bruno