Adam Lally wrote:
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.
Breaking user code is an argument... I agree.
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.
I don't think that this is very helpful since users often only see the
API and so they don't know that there are additional exception types
available unless they read the
documentation. But when they read the documentation we can also explain
them that they have to check the cause for the
AnalysisEngineProcessException
to get the real error.
Maybe the additional field at the AnalysisEngineProcessException can
help the user to detect the cause more easily. This also helps in a
first version for
"bad document" errors...
-- Michael