[Debtags-devel] Exception issues in Debtags::Environment

Benjamin Mesing bensmail@gmx.net
Sat, 04 Sep 2004 15:18:39 +0200


Hello,

I have found something in Debtags::Environment which really scares me as
it compromises safe programming. It is that false promises are made
about possible exceptions.
The following method can be found in Debtags::Environment
	virtual Vocabulary& vocabulary() const throw () = 0;
It guaranties no exception to be thrown. Looking into the code it leads
to calling the following function call

void StandardEnvironment::loadVocabulary() const throw ()
{
	_vocab.read();
	vocabLoaded = true;
}

This calls _vocab.read() which might raise some exceptions but the
function guaranties to raise no one, so in the result unexpected() will
be called and the program will be terminated. 
I would strongly suggest to either catch the possible exceptions from
_vocab.read() or add them to the signature of the
Environment::vocabulary() and StandardEnvironment::loadVocabulary(). I
would much prefer the latter case as else there would be no possiblity
to get to know that something went wrong.
I also suspect that there are other cases in the Environment class where
the same problem might appear but I didn't take a closer look there.

Greetings Ben