Exception Classes

Many customizations require the addition of exception handling and error reporting code. All the necessary infrastructure is provided to make this as simple as possible. A simple formulaic approach can be followed that will provide all of the necessary functionality. Before looking at how you can write customizations, you must first learn the necessary error reporting techniques.

All of the plug-in methods that throw exceptions, throw one of two exception types:

ConversionException is derived from DomainException, so instances of these exceptions can both be treated as DomainException objects when convenient. The ConversionException class is used for exceptions that are thrown by the methods of converter plug-ins. Unlike a DomainException, a ConversionException can be associated with a particular property of a server interface so that error messages reported to a user can indicate the label of the field in error and an error icon can be placed beside that field. The only exceptions that custom code normally needs to throw are instances of ConversionException, so this is the only exception class than needs to be understood to implement your own exception handling and reporting.

Conversion exceptions (and most other exceptions in the client infrastructure) carry information about the error message that needs to be reported, but not the error message itself. When an exception is thrown, the identifier of the localized error message string, the values that will be substituted for the placeholders in that string, and any causal exception object are included in the exception details. Each exception class can be associated with an error message catalog (a set of localized Java properties files) that is used when the localized message string is resolved from the message identifier. The localization and substitution steps are not performed until the message is reported to the user, so the exception can be propagated and augmented with more information for some time before the message string becomes fixed. This allows, in the case of conversion exceptions, the field label to be added automatically by the infrastructure after your custom code has thrown the exception and makes it very easy to integrate your error reporting requirements into the system.