Boost logo

Boost :

From: Beman Dawes (bdawes_at_[hidden])
Date: 2003-10-30 15:43:39

At 07:03 AM 10/30/2003, Peter Dimov wrote:
>Beman Dawes wrote:
>> At 03:22 PM 10/27/2003, Jessie Hernandez wrote:
>> >...
>> >Well, I personally prefer a "large" socket exception hierarchy. This
>> makes
>> >it very easy to catch specific exceptions and provides better error
>> >messages. With the current STL file classes, you may get errors
>> such as >"ios_base::failbit set!" (since there is only one exception
>> class, >ios_base::failure). This doesn't tell me why the failure
>> happened (does
>> the
>> >user have permissions to the file, etc.?) I'd rather have classes
>> such as >socket_base::connection_refused, etc., which have their
>> what() methods >overloaded to print out more specific messages.
>> FWIW, the LWG just looked at a similar situation for regular
>> expressions.
>> The solution they prefer is for a single exception class for the
>> library, but adding a member function which will return a code which
>> identifies the specific reason for the failure. This member function
>> is in addition to what().
>FWIW, following that LWG precedent in all cases is dead wrong. ;-)

Yes. Understood. You have to look at the specific case to see which is
best. If there is much conceptual separation between the causes of error,
a hierarchy would be better.


Boost list run by bdawes at, gregod at, cpdaniel at, john at