Version of Boost
1_82
Steps necessary to reproduce the problem
https://godbolt.org/z/7jdn9xh6f
The returned error is
terminate called after throwing an instance of 'boost::detail::with_throw_location<boost::system::system_error>'
what(): array size does not match target size [boost.json:31 at /opt/compiler-explorer/libs/boost_1_82_0/boost/json/detail/value_to.hpp:567:9 in function 'boost::json::result<T> boost::json::detail::value_to_impl(boost::json::try_value_to_tag<T>, const boost::json::value&, described_class_conversion_tag)']
Which is a bit misleading, it should be object size, but the problem is the lack of context, working with a big json will quickly require to have to use a debugger to pinpoint the actual element which had the error.
I think an error like, would be much better
The object at /path/to/2/object
Has more element than the destination T
Now I do understand the implication of building a json pointer for all the element can easily be a performance killer, so maybe defining a macro can be a viable option ?
Or I can try to play with somekind of linkedlist structure to store the string_view of the key that composes the path, and in case of error is assembled and used.
Version of Boost
1_82
Steps necessary to reproduce the problem
https://godbolt.org/z/7jdn9xh6f
The returned error is
Which is a bit misleading, it should be object size, but the problem is the lack of context, working with a big json will quickly require to have to use a debugger to pinpoint the actual element which had the error.
I think an error like, would be much better
Now I do understand the implication of building a json pointer for all the element can easily be a performance killer, so maybe defining a macro can be a viable option ?
Or I can try to play with somekind of linkedlist structure to store the string_view of the key that composes the path, and in case of error is assembled and used.