Added error check in readme example