Added error handling to EH.triggerEvent