E
Emanuele D'Arrigo
I'm pondering on what is a bit of a philosophical dilemma.
When should I throw an exception and when should I not?
Suppose I have myFunc1() calling myFunc2() which in turn calls myFunc3
().
Suppose myFunc3() has detected a problem. What should it do?
Throw an exception, forcing myFunc2() to handle it and/or trigger
another exception for myFunc1() to deal with? Or should it simply
return a meaningful error code, for myFunc2() and myFunc1() to handle
as an option but not forcing them to do so?
Manu
When should I throw an exception and when should I not?
Suppose I have myFunc1() calling myFunc2() which in turn calls myFunc3
().
Suppose myFunc3() has detected a problem. What should it do?
Throw an exception, forcing myFunc2() to handle it and/or trigger
another exception for myFunc1() to deal with? Or should it simply
return a meaningful error code, for myFunc2() and myFunc1() to handle
as an option but not forcing them to do so?
Manu