SeamFramework.orgCommunity Documentation
Integration of Seam Catch with other frameworks consists of one main step, and one other optional (but highly encouraged) step:
ExceptionToCatchEvent
An
ExceptionToCatchEvent
is constructed by passing a
Throwable
and
optionally qualifiers for handlers. Firing the event is done via CDI events (either straight from the
BeanManager
or injecting a
Event<ExceptionToCatchEvent>
and calling fire).
To ease the burden on the application developers, the integration should tie into the exception handling
mechanism of the integrating framework, if any exist. By tying into the framework's exception handling,
any uncaught exceptions should be routed through the Seam Catch system and allow handlers to be invoked.
This is the typical way of using the Seam Catch framework. Of course, it doesn't stop the application
developer from firing their own
ExceptionToCatchEvent
within a catch block.
An integration with Catch can define it's own handlers to always be used. It's recommended that any built-in handler from an integration have a very low precedence, be a handler for as generic an exception as is suitable (i.e. Seam Persistence could have a built-in handler for PersistenceExceptions to rollback a transaction, etc), and make use of qualifiers specific for the integration. This helps limit any collisions with handlers the application developer may create.
Catch supports qualifiers for theCaughtException
. To add a qualifier to be used when
firing
handlers they must be add to the
ExceptionToCatchEvent
via the constructor (please see
API docs for more info). Qualifiers for integrations should be used to avoid collisions in the application
error handling both when defining handlers and when firing events from the integration.