monvural All American 558 Posts user info edit post |
I'm building a website, and I was curious about the best way to return to the user that an error has occurred. Here's an example:
Check to see if username exists If it does throw exception back to user
I want to architect this properly, but I don't know how. Right now, I have a constructor in an AddUser class. It takes the values from a form and then runs an authenicate() method. I want authenticate() to throw exceptions back to the user if their request fails.
Do I do a try{}catch{} in my JSP? Any advice would be great. Thanks. 2/17/2007 11:53:18 PM |
ncWOLFsu Gottfather FTL 12586 Posts user info edit post |
try catch is good, then in the catch you can tell it to print an error message to the screen instead of a stack trace. 2/18/2007 11:52:43 AM |
philihp All American 8349 Posts user info edit post |
Read up on this directive:
<jsp:directive.page errorPage="url"\>
<%@ page errorPage="url"%> 2/19/2007 12:48:16 PM |
pmcassel All American 1553 Posts user info edit post |
I just recently came across this issue - on the best way to notify a user of an exception.
In your case, though, I thought that since exceptions were more for program / system errors, they should not be used to communicate issues / notices to users. Application errors and system errors do not equate to user interaction messages.
Correct me if I am wrong, but wouldn't a message queue or some kind of message interface to the user be more appropriate means to communicate these kinds of issues?
I would also like to hear other's input on both of these delimmas.
1) Architectures for communicating user and application interaction messages and errors 2) Architectures for communicating system and application errors (try, catch)
[Edited on February 19, 2007 at 1:25 PM. Reason : googling...] 2/19/2007 1:24:48 PM |
pmcassel All American 1553 Posts user info edit post |
http://www-128.ibm.com/developerworks/library/j-ejbexcept.html
Is pretty good. 2/19/2007 1:27:59 PM |