6 #ifndef KAGOME_CORE_COMMON_OUTCOME_THROW_HPP 7 #define KAGOME_CORE_COMMON_OUTCOME_THROW_HPP 9 #include <boost/system/system_error.hpp> 10 #include <boost/throw_exception.hpp> 18 template <
typename T,
typename = std::enable_if_t<std::is_enum_v<T>>>
20 std::error_code ec = make_error_code(t);
21 boost::throw_exception(std::system_error(ec));
29 template <
typename T,
typename = std::enable_if_t<!std::is_enum_v<T>>>
30 void raise(
const T &t) {
31 boost::throw_exception(std::system_error(t.value(), t.category()));
35 #endif // KAGOME_CORE_COMMON_OUTCOME_THROW_HPP