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

exception handling

 
Prakash Krishnamurthy
Ranch Hand
Posts: 154
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In this assignment, I many places in the code I have just caught Exception and printed out the stack Trace. I like doing this as this not only catches all the exceptions in one statement but also prints out the stack trace and points out the problem, if any.
Does anybody know if points could be deducted from the assignment for this? Is this a bad programming practice?
PK
 
Andrew Monkhouse
author and jackaroo
Marshal Commander
Pie
Posts: 12014
220
C++ Firefox Browser IntelliJ IDE Java Mac Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Prakash,
I dont think this is very user friendly, especially as many of the exceptions that can occur in this project can be handled programatically.
Example: if the user enters the wrong IP address when starting your client application - in your case, they are just going to see a stack trace (which, unless they are java programmers, will mean nothing to them). My option is to give them an error dialog informing them of what is wrong, and giving them a chance to correct it.
Even in real life I prefer to not only catch the exceptions, but if I really have to treat it as fatal, then I send the stack trace to file, and give the user very clear instructions on how to get the file to me (which they sometimes do).
I think you do need to make your application as user friendly as possible.
Regards, Andrew
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic