Add error callbacks.
Merge pull request #10 from otang/err-callbacks

Add error callbacks.