Hail King Hafsteinsson!

On Mar 25, 2009, at 6:47 AM, Atli Páll Hafsteinsson wrote:

My problem is the following:

We have a system that allows people to accept changes to their vehicle
registration online and the applications works as follows:

* changes are made to an existing eo-object
* the changes to the editing contex are saved (editingContext.saveChanges()) * an email notifying the user that the changes have been made is sent out

However we've had a scenario when the .saveChanges() failed without the application noticing and the notification email was sent out even though the
changes where not really made in the database.

How is that possible? Are you using Wonder? There is public void didUpdate() on ERXGenericRecord that should _only_ get called if the save succeeds. If you are using Practical WebObjects / GVC Frameworks code, the method is public void hasUpdated()



What is the best way to catch exceptions when .saveChanges() fails ?

try {
      ec.saveChanges();
} catch (Exception e) {
       //Do stuff to handle error
}

Or is there a better way ?

That should do it, excepting JVM errors like OutOfMemory


Chuck


--
Chuck Hill             Senior Consultant / VP Development

Practical WebObjects - for developers who want to increase their overall knowledge of WebObjects or who are trying to solve specific problems.
http://www.global-village.net/products/practical_webobjects






_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      ([email protected])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to