• Post Reply Bookmark Topic Watch Topic
  • New Topic

Handling Exceptions  RSS feed

 
Luke Shannon
Ranch Hand
Posts: 239
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What is the most client friendly way of handling caught Exceptions in a Servlet that a form has just posted too?

Right now I get an TomCat error page saying the Servlet in Unavailable if something goes wrong.

Thanks,

L
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65833
134
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am assuming that said exceptions are the result of program error rather than validation errors on the users' data? Exceptions should never be used to handle the latter.

If the former, I define my own error handling servlet in web.xml. This servlet logs all details of the error, perhaps e-mails the error information to the developer, and forwards on to a user-friendly (i.e. no stack trace) page that informs the user that a server error has occured and which offers links to try to recover back to prior to the point of failure.
[ October 01, 2004: Message edited by: Bear Bibeault ]
 
Luke Shannon
Ranch Hand
Posts: 239
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you again. You are a top-notch bartender, better than that "bartender" in the pub across the street. He doesn't even know what a Servlet is!?!
Your suggestion is just what I was looking for. I will hit the books and figure out how to implement that.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!