Ensure resize error from C++ is wrapped

Thanks to @papandreou