Add error checking to README example