Annotation Interface OnThrow


@Target(METHOD) @Retention(RUNTIME) public @interface OnThrow
Annotates a method in a @Pointcut class that should be run just after each method (or constructor) execution picked out by the Pointcut, but only if the method picked out by the Pointcut throws an Exception. Only one method in a @Pointcut class may be annotated with OnThrow.

An @OnThrow method can accept parameters annotated with any of the following: @BindReceiver, @BindParameter, @BindParameterArray, @BindMethodName, @BindTraveler or @BindThrowable. @BindTraveler can only be used if there is a corresponding @OnBefore method that returns a non-void type (the traveler). If @BindThrowable is used, it must be the first parameter to the @OnThrow method.

An @OnThrow method must return void. It is not able to suppress the original Exception or change the Exception that is thrown (at least not currently).