update code to add 'error' callback.
update to the readme