Chapter 5. Capturing Join Points on Exception Handling
This chapter shows how to include exception handling as part of the cross-cutting concerns you are applying to your application using aspects.
When an exception is thrown in Java, it is passed up the call chain
until it is either handled by a
catch statement as
part of a
try/catch block or it reaches the Java
run-time and causes a messy message on your console. If a Java
exception is caught then the exception is passed as an object to the
catch block where the appropriate
action can take place to handle the problem.
The aspects you are applying to your applications may find it useful
to know when an exception has been handled. It is quite possible that
part of the cross-cutting behavior you are implementing, using
aspects, requires something to be done in addition to, or instead of,
the normal behavior of a
AspectJ provides the
pointcut for use when you want to capture when a catch block has been
invoked with a particular type of exception. This chapter shows you
some of the ways to use the
in your aspects so that they can capture and interact with the
exceptions that can be raised by your target application.
5.1. Capturing When an Exception Is Caught
You want to capture when a particular type of exception is caught.
pointcut. The syntax of the
pointcut <pointcut name>( ...