ONJava.com -- The Independent Source for Enterprise Java
oreilly.comSafari Books Online.Conferences.


AddThis Social Bookmark Button
  Best Practices for Exception Handling
Subject:   throw new Exception("...")
Date:   2003-11-19 22:48:53
From:   anonymous2
Very good article, but there is one contradiction. The article says in '3. Try not to create...':

'But if you are not going to add extra information, then just throw a standard exception:
throw new Exception("Username already taken")'

This forces the client code to cast the net wide by catching 'Exception'. The article later states that this should be avoided:

'4. Do not catch top-level exceptions'

1 to 2 of 2
  1. throw new Exception("...")
    2003-11-20 09:46:28  gunjandoshi1 [View]

  2. throw new Exception("...")
    2003-11-20 01:59:31  anonymous2 [View]

1 to 2 of 2