RE: API exceptions - codes or hierarchy, or both?

[Replying via the publc list.]
 
Yes, we called it ISSUE-13 and we described it as follows:
 
"Should an explicit set of values be used for Exception codes, or should an enum type be used?" [1]
 
The most recent position was that we should not use enum types. Furthermore, it appears that if there are exceptions that specifically relate to the use of the vocabulary/ontology, then any exception codes for such situations should be obtained from the vocabulary itself, rather than being hard-coded in the API.
 
It was also mentioned that OMG IDL does not support exception inheritance [2], so option 1 was suggested as the approach to take. However, we never did any more investigation on the issue, and at the recent face-to-face in London we concluded that much of our IDL work was probably going to be done manually (thanks to poor tool support) and that in some cases we'd digress from the OMG IDL mappings. Exception inheritance would be a significant benefit for target OO languages like Java, C#, C++ etc, so if we think that options 2 or 3 have merit, we might reconsider the limits of the default IDL mappings for exceptions.
 
OMG IDL doesn't support exception nesting/chaining either.
 
Despite the limitations of OMG IDL in this area, I wonder if it is possible for us to use a manual mapping approach to work around the limitations, especially since it appears that our primary target languages are of the OO vareity? It's not unusual for people to suggest such approaches [3]. Indeed, from what was said last week (and soon to be reported in the F2F summary) we've already decided to work around some IDL mappings relating to string data types.
 
---Rotan.
 
[1] http://lists.w3.org/Archives/Public/public-ddwg/2007Jun/0017.html
[2] http://www.omg.org/issues/issue753.txt
[3] http://forums.bea.com/bea/message.jspa?messageID=200046481&tstart=315
 

________________________________

From: José Manuel Cantera Fonseca [mailto:jmcf@tid.es]
Sent: Tue 24/07/2007 10:56
To: Rotan Hanrahan
Subject: Re: API exceptions - codes or hierarchy, or both?



I'm not sure but I believe there is an open issue related to that point

Best Regards

Rotan Hanrahan escribió:
> The DDR API will require support for exceptions. Early drafts suggest two approaches to representing exceptions:
> 
> 1. Each exception is represented by a unique constant (e.g. short int). This constant may be contained in a generic exception class and interpreted by a generic exception handler.
> 
> 2. There's a base class for exceptions, and a hierarchy of more refined exception classes, each containing member attributes particular to the exceptions being thrown.
> 
> A third possibility is a hybrid of the two.
> 
> 3. Each exception has a code defined in the API specification, but the exception classes are also in a hierarchy. The handler may then recognise an exception either by its code, or by the class type associated with the exception.
> 
> Given the broad spectrum of target languages, I am inclined to consider the most flexible representation, so the third option is appealing. What do others think?
> 
> ---Rotan.
>
>
>  

Received on Tuesday, 24 July 2007 10:47:30 UTC