ThrowsAdviceInterceptor Class
Spring.NET 1.3.0 RC1 for .NET 2.0 API Reference

ThrowsAdviceInterceptor Class

Interceptor to wrap an after throwing advice.

For a list of all members of this type, see ThrowsAdviceInterceptor Members .


[Visual Basic]
<Serializable> _
Public NotInheritable Class ThrowsAdviceInterceptor
    Implements IMethodInterceptor, IInterceptor, IAdvice
public sealed class ThrowsAdviceInterceptor : IMethodInterceptor, IInterceptor, IAdvice

Thread Safety

Public static (Shared in Visual Basic) members of this type are safe for multithreaded operations. Instance members are not guaranteed to be thread-safe.


Implementations of the IThrowsAdvice interface must define methods of the form...

AfterThrowing([MethodInfo method, Object[] args, Object target], Exception subclass); 
The method name is fixed (i.e. your methods must be named AfterThrowing. The first three arguments (as a whole) are optional, and only useful if futher information about the joinpoint is required. The return type can be anything, but is almost always void by convention.

Please note that the object encapsulating the throws advice does not need to implement the IThrowsAdvice interface. Throws advice methods are discovered via reflection... the IThrowsAdvice interface serves merely to discover objects that are to be considered as throws advice. Other mechanisms for discovering throws advice such as attributes are also equally valid... all that this class cares about is that a throws advice object implement one or more methods with a valid throws advice signature (see above, and the examples below).

This is a framework class that should not normally need to be used directly by Spring.NET users.


Find below some examples of valid IThrowsAdvice method signatures...

public class GlobalExceptionHandlingAdvice : IThrowsAdvice
    public void AfterThrowing(Exception ex) {
        // handles absolutely any and every Exception...
public class RemotingExceptionHandlingAdvice : IThrowsAdvice
    public void AfterThrowing(RemotingException ex) {
        // handles any and every RemotingException (and subclasses of RemotingException)...
 using System.Data;
 public class DataExceptionHandlingAdvice
     public void AfterThrowing(ConstraintException ex) {
         // specialised handling of ConstraintExceptions

     public void AfterThrowing(NoNullAllowedException ex) {
         // specialised handling of NoNullAllowedExceptions

     public void AfterThrowing(DataException ex) {
         // handles all other DataExceptions...


Namespace: Spring.Aop.Framework.Adapter

Assembly: Spring.Aop (in Spring.Aop.dll)

See Also

ThrowsAdviceInterceptor Members | Spring.Aop.Framework.Adapter Namespace | IThrowsAdvice