[Licq-devel] Re: Exceptions

"Erik Johansson" <[email protected]>
Newsgroups gmane.network.licq.devel
Message-ID <[email protected]>
2007/8/21, Anders Olofsson <[email protected]>:
> > The second question is, should we use throw-specifications when
> > defining methods or simply document which exceptions are thrown?
>
> throw() specification on functions looks better to me, that way the
> compiler can also check if we throw something illegal.

I take it that you don't think we should add std::exception to all
throw specifications, but set our own std::unexpected handler?

> I think std::exception should at least be caugh somewhere and tell the
> user what happened and, if possible, do some kind of nice shutdown
> rather than just crash. Stack traces are always nice to get in these
> situations, in the error log if possible.
> But anything causing bad_alloc or bad_cast to be thrown is probably
> hopeless to recover from anyway so no need to add checks everywhere.
> Otherwise we will just get a lot of meaningless catch(...) { cout << "we
> got a problem here" << endl; }

Then I can remove the try-catch clause in Licq::Exception's
constructor? http://trac.licq.org/browser/branches/newapi/licq/src/exceptions/exception.cpp

> "Don't look for an error condition you don't know how to handle."

Have to try to remember this one.

// 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.