On 6/11/07, Michael Baessler <[EMAIL PROTECTED]> wrote:
For errors in the typeSystemInit() method of an annotator, annotator
writers can throw an AnnotatorConfigurationException or an
AnnotatorInitializationException.
Since the typeSystemInit() method is called during the annotator
process() method if the type system of the CAS has changed, the
process() method interface only allows to throw
AnalysisEngineProcessExceptions. So in case of
AnnotatorConfigurationExceptions or AnnotatorInitializationExceptions
thrown by the typeSystemInit() method the UIMA framework wraps these
into an AnalysisEngineProcessException.
For applications it is now hard to detect the cause of the error. They
ever have to check for underlying exceptions to decide if the error was
a document processing error or a configuration/initialization error. I
think this is not very intuitive and possibly unexpected by the users
that they get an AnalysisEngineProcessException that was caused by an
configuration/initialization error.
Is this something that we can fix? For example to allow the UIMA
process() method additionally to throw an
AnntatorInitializationException? If not, I think we should at least
document that behavior.
What do others think?
The exception situation isn't ideal. But adding new exception types
to methods will break user code, and I don't think it is worth it.
An alternative that wouldn't break compatibility would be to subtype
AnalysisEngineProcessException - or add a field to it then indicates
the "kind" of exception.
We've also had user requests for a standard kind of "bad document"
error. See UIMA-340.
-Adam