add TriangleError and raise error if triangle is invlaid