Re: Handling exceptions when saving editing conext changes
Re: Handling exceptions when saving editing conext changes
- Subject: Re: Handling exceptions when saving editing conext changes
- From: Atli Páll Hafsteinsson <email@hidden>
- Date: Thu, 26 Mar 2009 09:23:10 +0000
- Thread-topic: Handling exceptions when saving editing conext changes
Hi
On 3/25/09 6:57 PM, "Chuck Hill" <email@hidden> wrote:
> Hail King Hafsteinsson!
>
:D
>
> 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()
>
>
>
When reading your answear I figured that I was ofcourse lieing !! The code
sent out the notification email before it tryed to save the changes to the
database, very good :) My new code however does not and catches and logs
errors :)
.. And yes we use wonder :)
>> 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
>
Should be sufficient, thanx for the help.
Atli
>
> Chuck
>
Fyrirvari á tölvupósti / e-mail disclaimer
http://us.is/Apps/WebObjects/US.woa/wa/dp?id=3776
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden