include error trapping in example code
update README with error trapping