Why are Exceptions said to be so bad for Input Validation?

Reading these answers, I find it very unhelpful to say, “Exceptions should only be used for exceptional conditions”. This begs the whole question of what is an “exceptional condition”. This is a subjective term, the best definition of which is “any condition that your normal logic flow doesn’t deal with”. In other words, an exceptional condition is any condition you deal with using exceptions.

I’m fine with that as a definition, I don’t know that we’ll get any closer than that anyway. But you should know that that’s the definition you are using.

If you are going to argue against exceptions in a certain case, you have to explain how to divide the universe of conditions into “exceptional” and “non-exceptional”.

In some ways, it’s similar to answering the question, “where are the boundaries between procedures?” The answer is, “Wherever you put the begin and end”, and then we can talk about rules of thumb and different styles for determining where to put them. There are no hard and fast rules.

Leave a Comment