This week's book giveaway is in the JavaScript forum.
We're giving away four copies of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js and have Paul Jensen on-line!
See this thread for details.
Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Proper way to write try , catch block  RSS feed

 
S Majumder
Ranch Hand
Posts: 349
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi every body , I have a code something like below :




Is this the proper way to duck and catch the exception ?

Thanks and regards,
S
 
Rob Spoor
Sheriff
Posts: 21047
85
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why are you catching an exception with a lot of detail information most importantly its type), then wrap it in a generic Exception? Just don't catch the exception and let the method simply throw it:
Moving to Beginning Java.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!