File indexing completed on 2026-08-17 08:52:04
0001
0002
0003
0004
0005
0006 #ifndef BOOST_OPENMETHOD_POLICY_THROW_ERROR_HPP
0007 #define BOOST_OPENMETHOD_POLICY_THROW_ERROR_HPP
0008
0009 #include <boost/openmethod/preamble.hpp>
0010
0011 #include <sstream>
0012 #include <stdexcept>
0013 #include <string>
0014
0015 namespace boost::openmethod::policies {
0016
0017
0018
0019 struct throw_error_handler : error_handler {
0020
0021
0022
0023 template<class Registry>
0024 class fn {
0025 public:
0026
0027
0028
0029
0030
0031
0032
0033 template<class Error>
0034 [[noreturn]] static auto error(const Error& error) -> void {
0035 struct wrapper : Error, std::runtime_error {
0036 wrapper(const Error& error, std::string&& description)
0037 : Error(error), std::runtime_error(description) {
0038 }
0039 };
0040
0041 std::ostringstream os;
0042 error.template write<Registry>(os);
0043
0044 throw wrapper(error, os.str());
0045 }
0046 };
0047 };
0048
0049 }
0050
0051 #endif