Exception and message handling
The constructor handles exceptions and document messages.
Constructed document messages are added for specific documents during document-related actions. These messages do not affect the overall document construction process. The IConstructedDocument interface enables the constructor to handle these messages, adds messages to the document message list, and continues to process the next document.
Constructor exceptions are thrown during the execution of constructor methods. Each method can throw a particular exception type that is defined in the IConstructor interface.
The severity level of constructor exceptions can be either error/critical, warning, or info. A critical exception ends the indexing process. A warning exception allows the indexing process to continue running.
In addition to the severity level, a constructor exception contains an IMessage object that provides more details about the exception. The message description is localized; the default locale of the system is used for the message description.
Document messages are localized according to the locale of the document. The document locale is determined by using the IConstructedDocument.getLocale method.
A basic IMessage implementation called FormattedMessage is provided. You can extend the implementation according to your requirements. A FormattedMessage message contains localized message text, the message type or level which can be one of the predefined values of IMessageType, and the message code.
Basic IMessage implementation of all possible exceptions is provided as follows:
- ConstructorInitException extends ConstructorException
- This exception is thrown by the Constructor.initialize method when an attempt to initialize a constructor fails for any reason. The error details are passed in the IMessage member.
- ConstructorCongifurationException extends ConstructorException
- This exception is thrown by the Constructor.setConfiguration method when an attempt to set runtime constructor configuration fails for any reason. The error details are passed in the IMessage member.
- PopulateDocumentsException extends ConstructorException
- This exception is thrown by the Constructor.populateDocuments method when an attempt to populate a document fails for any reason. The error details are passed in the IMessage member.
- FilterServiceException extends ConstructorException
- This exception is thrown by the IFilterService.extractText method when an attempt to filter text fails for any reason. The error details are passed in the IMessage member.