Error Handling

Added some additional error handling, and event to handle error in calling code.