Boost logo

Boost :

Subject: Re: [boost] [system] Would it be possible to trial a breaking change to Boost.System and see what happens?
From: Andrey Semashev (andrey.semashev_at_[hidden])
Date: 2018-01-12 21:33:57


On 01/12/18 23:38, Peter Dimov via Boost wrote:
> Andrey Semashev wrote:
>
>> I don't think this matches my intent. The `foo` function belongs to
>> the domain that defines error codes described by the `my_errors` enum
>> and it is supposed to return one of those codes. Preserving whatever
>> error category was set in `err` on entry does not achieve that. What I
>> want is that `err` has `my_category` unconditionally on return from
>> `foo`.
>
> In the general case, foo can call bar, which can also fail and return
> whatever error_code it likes. This is analogous to exceptions; mandating
> that functions from a specific domain only ever throw exceptions from
> that same domain quickly becomes burdensome.

I wouldn't say so. If I'm writing a library I would make it throw
exceptions that belong to it. If it uses e.g. Boost.Filesystem then in
the parts where it is used Boost.Filesystem can throw its own
exceptions, which may propagate to the user. But in no case would I be
throwing Boost.Filesystem exceptions myself from my library.

It's the same with error codes. The only difference is that we have to
have a success error code as well.


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