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

printStackTrace

 
Tim Adam Cooper
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In the developer assignment, there is a Data class that throw exceptions in which I trap those exception using try/catch.
Question: In the catch parameter, I use catch(e.printStackTrace) in order to display the various error messages to the MS-DOS window. Is that OK or should I display a more friendly error message using JOptionPane?
 
Andrea Gazzarini
Ranch Hand
Posts: 125
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In my implementation, the data class is a part of server world, so when an exception is thrown, the code look like this:

catch(DatabaseException ex){
..// log the stacktrace, but on the server out!
..ex.printStackTrace();
..throw new MyException("a detail exception description eventually sent to the client...");
}
the stack trace is printed out on the server, so it is used only for a debug purpose. No stack trace is sent to the client.
Hope it helps.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic