I hope this is not a duplicate. I searched here and there but I couldn't find an answer. I have a custom class and the constructor demands a certain type of object to be passed to it. I can easily check within the constructor if the object is valid (eg != Nil, etc...) and at the end of these checks I would like to have an option to throw an exception and avoid the object creation. Is throwing an exception the answer? Is there any other better way?
Thank you in advance for your support