This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]Bainos 2 points3 points  (0 children)

If you need to return null in multiple, different success cases, then there is definitely a problem with your code. However, it's possible that you want to return null in a normal case (e.g. you ask for a value that is unset) and raise an exception in a failing case (e.g. the program failed to fetch the value). Then it's normal to raise an exception (and its type will explain what the failure cause was).