Maybe it is an obvious question, but I need to ask help for it.
I need to know how to handle exceptions in OCC.
User input can crash my application, for instance, making a segment with equal points.
My first approach was:
if (!GC_MakeSegment(pA, pB)) return false;
expecting a Null value, but app crashes.
My second approach was:
catch (...) //Or even (Standard_Failure e)
Nothing to do, crashes any way.
So I have to think about possible problems in my code and to be ready for those, such as
if (pA == pB) return false;
but there is no operator= for gp_Pnt.
My last try is
if ((pA.X()==pB.X()) && (pA.Y()==pB.Y()) && (pA.Z()==pB.Z())) return false;
I hope (I am sure) there are better ways to manage exceptions.
Could you give me some advises to start with it?
I tried to search with Exception, Try, Catch, keywords in the forum but I always find topics nothing related with my subject.