• Post Reply Bookmark Topic Watch Topic
  • New Topic

Proper way to write try , catch block

 
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: 20820
68
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!