What to do when construction fails?
Posted on 1998-06-29
Lets say I have a constructor that does some operations, for some reason one or more of these operations fail. What is the best way to set some sort of error condition?
A a = new A("filename");
say the filename doesn't exist, now probably any operation I do with a will also fail. Do I use exceptions? Add a class function to check for valid creation?
I am not dealing with IO in any sort in my situation, just using it to clearify my problem