Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

(B&S)Handling IOExceptions et al?

 
Saheed Adepoju
Ranch Hand
Posts: 267
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all
Having checked out the way fellow ranchers handled IOExceptions by wrapping it round a sub-class of RuntimeExceptions, i was if someone could validate my little pseudocode!
Assume i have :


So assume i encounter and IOException, i could say:



As stated above, is this enough to handle the defiency of the DB(Sun's given interface)! Thanks!
 
Daniel Dalton
Ranch Hand
Posts: 146
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi - you're creating the new exception using the String argument constructor. Why not use the constructor that takes the exception itself - or create another that takes the exception AND a message string? That way, the cause will be initialized so that it would be available (if you wanted it in the future) at the level to which you're throwing the RuntimeException.
 
Saheed Adepoju
Ranch Hand
Posts: 267
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks a lot! Noted i will implement the changes!And document!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic