Hey

A while ago I raised a question about how Exceptions work. One thing I didn't ask though is what would happen if I threw an exception with the constructor of a class.

For example, I have a class that reads a configuration file when the program starts up. If I was to put the fil reading part all in the constructor, and throw an exception if the file can't be found/read, could I catch that exception and alert the user theres no file and shut down the program?

I was wondering this because I was told that constructors can't return a value, so this led me to thinking about exceptions. I'm just worried that maybe if I throw an exception with a constructor the class might not be created properly.

So what I'm asking is, is it safe to throw exceptions with constructors?