| 225 | // overload `toString` functoion to throw exception from custom `Expected::error` type |
| 226 | template<typename E> |
| 227 | [[noreturn]] void throwExceptionFromExpected(const E& err) |
| 228 | { |
| 229 | if constexpr (std::is_nothrow_convertible<E, std::string>::value) |
| 230 | throw std::runtime_error(err); |
| 231 | else |
| 232 | throw std::runtime_error(toString(err)); |
| 233 | } |
| 234 | |
| 235 | // Like `e.value()`, but throws using `throwExceptionFromExpected` (which is better, because it allows Python to see the proper error message), and also supports `T == void`. |
| 236 | template <typename T> |
no test coverage detected