Mere moments ago, quoth I:
Perhaps boost::throw_error, which is expected to internally construct an appropriate exception based on its argument type and then call boost::throw_exception?
To clarify, I was wondering if we should: 1. Implement an error-to-exception conversion trait as a generic template which does not compile by default. 2. Provide a specialisation for boost::system::error_code which returns boost::system::system_error. 3. (Where supported by the STL) Provide a specialisation for std::error_code which returns std::system_error. 4. Allow users to provide additional specialisations for other error types. 5. Provide generic boost::throw_error which calls boost::throw_exception on the result of the conversion trait. 6. Make Outcome's default policy call boost::throw_error instead of hard UB. The people who want hard UB can still use a policy that requests it. Everyone else will get a compile error until they either implement the conversion trait, use an error_type which is already implemented, or switch to a UB policy. Bonus: the conversion trait provides an easy way to ask metaprogramming questions such as "what is the exception type for this error code" or "is this a throwable error code type".