Stoitcho Goutsev (100) said:
Nick,
You have right to disagree. That's why I said that this is my personal
opinion.
Very reasonable of you. I'm not that reasonable - I think that I'm right and
you're wrong
I'd say it is not common for code to catch *new* statement in a try/catch
and that almost no one check the docs if the constructor throws an
exception.
It is not common because most ctors don't normally throw but the it is not
common to call most methods in a try/catch block either for the same reason
so what's your point?
People will check the throw spec of any method or constructor that they
think will perform checks that might fail or that allocates resources.
One thing that nobody EVER checks is whether or not the form that they just
told to show itself actualy did so. One of the reasons that exceptions are
the foundation of error reporting in modern langauges rather than return
codes or statuses is that experience has shown that nobody ever checks
those.
You are also arguing against yourself in some ways - If it is normal to
throw in the ctor then it will certainly show up in testing and no harm is
done - it is only if it is not normal i.e. exceptional that it might cause a
problem in a deployed app but, as you said, exceptional is exactly what
exceptions are for.