|
Boost : |
From: Rainer Deyke (rdeyke_at_[hidden])
Date: 2022-05-29 06:02:52
On 29.05.22 00:39, Andrzej Krzemienski via Boost wrote:
> Hi Everyone,
> I wanted to share an observation. A number of Boost libraries, in
> documentation, when it comes to demonstrating that a given function throws
> an exception, has a code sample like the following:
>
> try {
>> lib::function();
>> }
>> catch(lib::exception const&) {
>> // handle failure
>> }
>>
I don't think there's anything wrong with that code. Exceptions should
be handled at the point where it makes sense for the program. Sometimes
that's far up the call tree, but just as often it's very close to where
the exception is thrown. The value in exceptions is not just that they
can be handled non-locally, but that they provide a uniform way of
handling both local and non-local failures.
-- Rainer Deyke (rainerd_at_[hidden])
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk