added try/catch in README code snippet