Boost logo

Boost :

Subject: Re: [boost] program options (consider using BOOST_THROW_EXCEPTION)
From: Alex Perry (Alex.Perry_at_[hidden])
Date: 2012-06-26 13:03:11


 Rowan James on 26 June 2012 13:49 wrote :
>If I can make the case in favour of BOOST_THROW_EXCEPTION, it is for the very reason that they are reporting user mistakes. The throw location for an exception is typically >accompanied by, or at least close to, the logic that delineates such a user mistake from acceptable input. As such, it is a useful remedy in itself; but also gives the user specific >information for finding documentation relevant to fixing the error. Without it, we have at best the entry point into the library that; and often a lot less if the exceptions are caught at >a higher level.

>Documentation for valid inputs or states to a function can only say so much about all the possible errors or exceptions that may occur.

+1 here

I had a case of this with either program_options or property_tree (can't remember which) not that long ago and remember wishing that the library had used boost exceptions rather than some boost:any derived library specific error handling for this very reason. Instead had to step through library code to work out why it had a problem with the particular input.

Alex Perry


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