Closed heretic13 closed 3 months ago
No useful information about the location of the error
Replacing
boost::system::result<int> GetParameter()
{
return make_error_code(boost::system::errc::invalid_argument);
}
compile and run
more usefull information
Boost system result can hard assume the presence of Boost exceptions, and thus tailor itself so.
There is a sizeable minority of Outcome users who cannot accept the use of source_location
, as it bloats binaries and makes them unusable for embedded targets.
For this reason, no default location capture has been implemented, but we did provide hooks via which you can implement your own. Indeed the tutorial https://ned14.github.io/outcome/tutorial/advanced/hooks/keeping_state/ describes a stack backtrace capturing implementation.
Unlike Boost.System, Outcome is ABI stable so extending .value()
to capture source_location
won't be possible.
I'm going to assume this issue is closed. Thanks for the feedback.
Hello.
I wrote a test program.
When I run the program, it crashes as expected.
But the source_location that is attached to the exception does not say anything - it refers to the file and line number inside the "outcome" library.
If I use boost::system::result then the source_location will refer to the position where there was an unsuccessful .value() call on the result<> object. Because the boost::system::result::value() method creates a source_location object at this very moment.
I know for sure that in Rust, a similar .value() call to "result" in the trace should show the line of code for the unsuccessful .value() call.
I have a question. Is this buggy behavior in the "outcome" library and will it be fixed? Or is this a “feature” of your library?