Factor out handling of "normal" and "error" events.