In my environment, I write the SSIS event information to a log table, so I have not had to capture it as you are asking. However, it appears to me that you would use the Event Handler tab in SSIS and use a Script Task to capture OnError information and save to a variable.