// Collection of code snippets by Arne Vajhøj 
// (from articles on eksperten.dk / vajhoej.dk written sometime between 2004 and now) 
import java.lang.reflect.*;

import org.aspectj.lang.*;
import org.aspectj.lang.annotation.*;

@Aspect
public class Error {
    @Pointcut("call(public * IntMath.*(..)) || call(public * DoubleMath.*(..))")
    void matherror() { };
    @AfterThrowing(pointcut="matherror()", throwing="e")
    public void oops(Throwable e) {
        System.out.println("Exception in math calculation ---- " + e);
        System.exit(0);
    }
}
