Add basic error handling to the EventDispatcher class