Added error event callback option
Simple test page for error callback
Included a more advanced example in comments