W3C home > Mailing lists > Public > public-ddwg@w3.org > July 2007

API exceptions - codes or hierarchy, or both?

From: Rotan Hanrahan <rotan.hanrahan@mobileaware.com>
Date: Tue, 24 Jul 2007 10:50:21 +0100
Message-ID: <D5306DC72D165F488F56A9E43F2045D39C6AC5@FTO.mobileaware.com>
To: <public-ddwg@w3.org>

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 09:50:29 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 19:30:50 UTC