Fixed the error handling in the MessagingHelper