Le 29/05/2017 à 09:04, Gavin Lambert via Boost a écrit :
On 29/05/2017 18:12, Vicente J. Botet Escriba wrote:
What your checked_outcome<T>::error will return if the is a exception_ptr? Ah, finally someone brought this up. Good!
It returns an error_code with bad_outcome_category and bad_outcome_errc::exception_present. Ugh. Why your design is never coherent. Why you don't name your functions after what they do? What if the exception_ptr contains an arbitrary exception? No way to obtain an error_code :( I believe your design is too much guided by your AFIO use case. Not all the applications use system errors.
I think you may have misinterpreted that. Niall's saying (if I haven't misinterpreted myself) that calling error() on an outcome that contains any arbitrary exception will give that one specific error code (which basically tells you that your code is probably wrong to have asked, but it's not a precondition violation). Of what specific error code are you talking about? How do you get one from exception_ptr?
That sounds like it's what you're wanting, and it's probably the behaviour I'd expect.
(There might be some argument that if the contained exception happens to be a std::system_error then it might be nice if the contained error_code could be extracted and returned, but that's not what Niall said and it sounds like that's what you're objecting to.) See above.
Vicente