|
Boost : |
Subject: Re: [boost] program options (consider using BOOST_THROW_EXCEPTION)
From: Vladimir Prus (ghost_at_[hidden])
Date: 2012-06-27 05:41:25
On 26.06.2012 21:03, Alex Perry wrote:
>
>
> 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.
What practical value would source location somewhere in any.hpp give you?
- Volodya
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk