- Notifications
You must be signed in to change notification settings - Fork 105
Open
Description
Given the following use case that comes from the documentation:
#include <iostream> #include <string> #include <boost/json/src.hpp> #include <boost/describe.hpp> #include <boost/exception/diagnostic_information.hpp> struct money { std::string currency; double value; }; BOOST_DESCRIBE_STRUCT(money, (), (currency, value)) struct test { double pi; bool happy; money object; }; BOOST_DESCRIBE_STRUCT(test, (), (pi, happy, object)) int main() { boost::json::value jv = { { "pi", 3.141 }, { "happy", true }, {"object", { //{ "currency", "USD" }, { "value", 42.99 } }} }; try { test res = boost::json::value_to<test>(jv); } catch (std::exception const& ex) { std::cerr << boost::diagnostic_information(ex, true) << std::endl; } return 0; }The missing currency member gives the following exception:
Dynamic exception type: boost::detail::with_throw_location<boost::system::system_error> std::exception::what: unknown name [boost.json:39 at /nobackup/lid00lima21/debionne/miniconda3/envs/lima2/include/boost/json/detail/value_to.hpp:371 in function 'operator()']It would be interesting to have an information where the exception occurred in the json value during value_to conversion. Ideally something like errinfo_json_path="object.concurreny".
Metadata
Metadata
Assignees
Labels
No labels