Quando usare le eccezioni...

Share on:

Sono senza parole... è una frase geniale!

I can't remember where I initially saw it, but the best advice I've seen for when to use exceptions is as follows:

"Don't pee your pants in order to see if your fly is unzipped."

You should always check to see that you are in a valid state before proceeding rather than throwing a likely exception.

Fonte: Exceptional rule of thumb

Post originale