Re: Best Practice? - error handling
Re: Best Practice? - error handling
- Subject: Re: Best Practice? - error handling
- From: Sam Barnum <email@hidden>
- Date: Tue, 10 Aug 2004 12:55:07 -0700
Another way which is probably more php-ish, and less work than the
method in the article, is to set messages in the Session, which are
displayed at the top of your page, or wherever you prefer.
After displaying the message, reset the array of messages in the
Session.
You can use plain Strings as messages, or build a custom object which
has more info about what type of message it is, as well as the actual
message text. Then, anything that can access the session can append a
message to the list, which should be displayed to the user the next
time a response is generated.
You might even go so far as to include the actual exception in the
message class, since most NSValidation messages have detailed info
about the keypath and object that produced the exception.
It's also usually a good idea to override validationFailedWithException
in your component to capture the errors and log these to the session.
On Aug 10, 2004, at 11:29 AM, Kieran Kelleher wrote:
Check out this approach .... I like it, works well.
http://www.stepwise.com/Articles/Technical/2001-06-13.01.html
-Kieran
________________________________________________________________
Dev Config = OS X 10.3.4 / Java 1.4.2 / WO 5.2.3 / XCode v1.2 / MySQL
4.0.20 / Connector-J 3.0.11
Deploy Config = OS X 10.3.4 Server / Java 1.4.2 / WO 5.2.3 / MySQL
4.0.20 / Connector-J 3.0.11
My Blog: http://webobjects.webhop.org/
Meet other WO Developers at http://webobjects.meetup.com
On Aug 9, 2004, at 12:17 PM, William Norris wrote:
Have a question regarding the best way to do error handling in WO,
specifically getting the error information displayed to the user. In
my old Java days making command line apps, it was a simple S.o.p() and
that was that. In my more recent days with PHP, I would often have a
global variable $errorMsg... at the top of most every page, it was
checked for contents and they would be printed out if any.
So about other developers? Of course try/catch blocks will catch the
error at any arbitrary place in your code and allow you to die
gracefully, but do you have a particularly interesting or efficient
way of getting the error message to the user and allowing them a way
to respond to it.
-will
_______________________________________________
webobjects-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/webobjects-dev
Do not post admin requests to the list. They will be ignored.
_______________________________________________
webobjects-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/webobjects-dev
Do not post admin requests to the list. They will be ignored.
_______________________________________________
webobjects-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/webobjects-dev
Do not post admin requests to the list. They will be ignored.