Boost logo

Boost :

From: Jessie Hernandez (jessie_at_[hidden])
Date: 2003-10-30 16:40:15


"Peter Dimov" <pdimov_at_[hidden]> wrote in message
news:003101c39f21$89f1d3d0$1d00a8c0_at_pdimov2...
> 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?
> _______________________________________________

I think I agree with you in that I like the hierarchy the way it is now. But
some have complained that the current hierarchy (which involves 20 exception
classes) is too big. Also, I don't see too many exception classes for any
library in the STL (though this precedent may not apply to sockets, since
any operation dealing with sockets can fail, and usually for several
reasons).

I personally hate the idea of just having one exception class for a sockets
library. I foresee many if() or switch() statements in client code if this
is done, since any number of things could have happened, as I mentioned. At
the same time, though, I want the majority of the users to be comfortable
with the library, so if more people feel comfortable with having a small
amount of exception classes, then I'll reduce it (my proposal is to reduce
it to 9 classes).

Also, if the LWG preferred having just one exception class for regular
expressions, they most probably won't accept the socket exception hierarchy
I have now, but maybe they would accept a small amount of classes. I am not
familiar with the Boost regular expression classes, but I have used regular
expressions extensively in both Perl and PHP, and based on my use, I don't
see a regex library generating too many different types of exceptions
(forgive me if I'm mistaken. All I see it generating is an exception which
indicates that the search pattern was malformed). But the sockets library is
a different beast altogether, that's why I'm in favor of having more than
one exception class.

For these reasons, I think providing a minimal number of exception classes
is the middle-ground. I don't consider it a "virtue", but I think this
change will please most users.

--
Jessie Hernandez

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