Boost logo

Boost :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2003-10-30 17:26:24


Scott Woods wrote:
> ----- Original Message -----
> From: "Peter Dimov" <pdimov_at_[hidden]>
> To: "Boost mailing list" <boost_at_[hidden]>
> Sent: Friday, October 31, 2003 9:08 AM
> Subject: Re: [boost] Re: Re: Re: Sockets!
>
>
>> Jessie Hernandez wrote:
>> [...]
>>> The above hierarchy, I think, is the best of both worlds: you have a
>>> minimal number of exception classes covering broad types of errors.
>>
>> But _why_ is having a minimal number of exception classes a virtue?
>> _______________________________________________
>
> My $0.02
>
> If there is a general acknowledgement that exception-hierarchies
> and exception-classes-returning-codes are two valid error-propagation
> techniques then;
>
> * maybe the "perfect balance" for the use of both is something decided
> by the author of each piece of software (subject to reviews of
> course).
> * exception-hierarchies cannot be "passed on". with classes-returning-
> codes it is pretty trivial to detect an exception and then pass codes
> to other methods/functions. doing something equivalent from inside
> a catch() {} is not the same. for this reason I do minimize the number
> of exception classes. but maybe laziness is not a valid influence on
> the balance of "exception-hierarchies and
> exception-classes-returning-codes"

You seem to forget that these two approaches are not mutually exclusive. You
can still have a member function of the base of the hierarchy that returns
the error code, allowing users that are only interested in the error code
(to translate it into a message to be displayed, perhaps) to catch all, or
part, of the hierarchy.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk