Questions related to handling errors and exceptions.
68
votes
10answers
4k views
The modern way to perform error handling…
I've been pondering this problem for a while now and find myself continually finding caveats and contradictions, so I'm hoping someone can produce a conclusion to the following:
Favour exceptions ...
17
votes
15answers
3k views
Arguments for or against using Try/Catch as logical operators
I just discovered some lovely code in our companies app that uses Try-Catch blocks as logical operators.
Meaning, "do some code, if that throws this error, do this code, but if that throws this error ...
72
votes
12answers
5k views
How big does my project need to be for me to unit test it?
I assume that my project is decoupled enough to allow for unit testing. But how big, exactly, in terms of clases and functions does my project need to be to make unit testing worthwhile?
We all make ...
41
votes
10answers
2k views
I've been told that Exceptions should only be used in exceptional cases. How do I know if my case is exceptional?
My specific case here is that the user can pass in a string into the application, the application parses it and assigns it to structured objects. Sometimes the user may type in something invalid. ...
52
votes
13answers
4k views
Should one check for null if he does not expect null?
Last week, we had a heated argument about handling nulls in our application's service layer. The question is in the .NET context, but it will be the same in Java and many other technologies.
The ...
5
votes
2answers
200 views
Is error suppression acceptable in role of logic mechanism?
This came up in code review at work in context of PHP and @ operator. However I want to try keep this in more generic form, since few question about it I found on SO got bogged down in technical ...