[RFC]CID 71507: Unchecked return value (CHECKED_RETURN)

Check for the return value of object_to_vim instead of checking for err.set
Also need to check `if (err.set)`