You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Feb 15, 2024. It is now read-only.
I was surprised to see it's not an error to call push_back on UniValues that aren't arrays and pushKV on UniValues that aren't objects. Is this by design? It caused a bug recently: bitcoin/bitcoin#10450
The text was updated successfully, but these errors were encountered:
Typically UniValues do not change types at runtime, implying this pattern is a programmer error. That implies an assert() might be a better choice than an exception.
I didn't realize push methods already do have a return value indicating success. So failure is at least detectable, even if there is some reasoning for treating it like a programmer error instead of a runtime error.
Since it doesn't appear there are any asserts used so far in univalue code, and asserts aren't easy to catch in unit testing, and since there would be some overhead in throwing a std::logic_error, I think I'd be inclined not to make any changes, and will close this issue. Thanks for taking a look.
I was surprised to see it's not an error to call push_back on UniValues that aren't arrays and pushKV on UniValues that aren't objects. Is this by design? It caused a bug recently: bitcoin/bitcoin#10450
The text was updated successfully, but these errors were encountered: