sanitized eventing code to handle all error cases