Added error handling to text and images example