This doesn't seem to check for `const`ness, is that all done at the C++ layer?  Is it an unhelpful error message?  If so, might be worth putting a check and a proper exception here first...