Added an error trap if the triple generation failed