Don’t throw Exception

Hi. Today I want to talk about a common problem in many frameworks I encountered over the course of my carrier as a Java dev / automation engineer, whatnot. Throwing Exceptions. That is in your method you have something like this: public void insertMethodNameHere(String param) throws Exception {} This is bad. And I will tell you in short forms why. Hides exceptions This one should be obvious. When a method throws exception you can never be sure what kind of exceptions it handles. It will hide what problems it can encounter. It will hide possible threats and will generally mean nothing to you when it fails. ...

June 13, 2012 · 4 min · hannibal