package com.bnorm.auto.weave.internal.chain;

import com.bnorm.auto.weave.AfterThrowingJoinPoint;
import com.bnorm.auto.weave.internal.Pointcut;

public abstract class AfterThrowingChain extends WrapChain {

    public AfterThrowingChain(Chain wrapped, Pointcut pointcut) {
        super(wrapped, pointcut);
    }

    @Override
    public final Object call() {
        try {
            return super.call();
        } catch (Throwable error) {
            AfterThrowingJoinPoint afterThrowingJoinPoint = new AfterThrowingJoinPoint(pointcut, error);
            afterThrowing(afterThrowingJoinPoint);
            throw error;
        }
    }

    protected abstract void afterThrowing(AfterThrowingJoinPoint afterJoinPoint);
}

@@ -423,17 +423,23 @@
 ch (
-Throwable
+MethodException
  err
@@ -546,16 +546,27 @@
 t, error
+.getCause()
 );%0A     

Fix after throwing chain to catch the right exception