The Right Approach to Exceptions

Sean Kelly sean at
Mon Feb 20 12:05:11 PST 2012

On Feb 20, 2012, at 11:54 AM, Juan Manuel Cabo wrote:

> About this part:
>>> What you want is throw a COMException and link it to the original
>>> Exception. You have to consider Exception as a linkedlist, one
>>> being the cause of another.
> The Variant[string] is an idea to help avoid people creating new kinds
> of exception types that don't add nothing.

I don't think this makes sense.  To effectively use whatever's in the table I pretty much have to know what error I'm handling, and this isn't possible if type information is lost.  Unless this determination is moved to a run-time check of some field within the exception, and then I'm making my code that much messier and less efficient by putting in tests of this identifier against a list of constants.  Personally, I don't see any use for this table beyond providing context, much like we already have with file, line, etc.

More information about the Digitalmars-d mailing list