[Licq-devel] Re: Exceptions

"Erik Johansson" <[email protected]>
Newsgroups gmane.network.licq.devel
Message-ID <[email protected]>
2007/8/23, Jon Keating <[email protected]>:
> > Yes, if you're gonna have that kind of error handling for every call,
> > we'll have 10 times the size of the code just for all those catch
> > blocks. Better to have it in one place and make that as good handling as
> > possible.
>
> Why have it only one place? Why not have it in the appropriate places: The
> boundaries of the daemon. Even without an exception specification, the
> document should provide the details of what exceptions to expect. Other
> exceptions, should indicate a fatal error condition. i.e., no memory left,
> corrupted memory, etc.

I have to agree that it is more flexible to have it in the appropriate
places. But this means that either a) std::exception is listed in
every exception specification, or b) we don't use exception
specifications. Since all exceptions inherit from std::exception, a)
is pretty useless which leaves b) as the only option.

On the other hand, there exists one big advantage with using exception
specifications without listing std::exception, and installing a custom
unexpected_handler that prints a backtrace: it is possible to
determine from which function the exception (e.g. std::bad_alloc) was
thrown from.

Additionally, since nobody said anything else, I take it we have
decided to use a separate exception hierarchy.

// Erik

-- 
Erik Johansson
http://ejohansson.se/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.