• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag
 

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
D2W Validation error "swallowed"
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

D2W Validation error "swallowed"


  • Subject: D2W Validation error "swallowed"
  • From: David Avendasora <email@hidden>
  • Date: Mon, 29 Aug 2011 06:57:15 +0800

Hi all,

I've noticed a place where a validation error is swallowed by my D2W app. I'm not sure where the expetion is getting lost because ERMDDeleteButton catches it, and calls parent().validationFailedWithException(e, e.object(), e.key()); (line 129 in ERMDDeleteButton) but the error never shows up in the UI. The UI makes it look as though the delete was successful, but it wasn't.

The situation is this: I'm deleting an EO, but the EO has a toMany relationship with a deny delete rule. I'm overriding mightDelete() to move the related objects to a different EO. If the _destination_ EO is invalid (missing required data) then it fails validation (as it should) and the EC can't be saved.

For example, let's say I have students that are registered for a math class. That class is canceled, so all the students associated with it should be moved to the next available math class. The problem is that the math class that the students are moved to doesn't have a start time, which is a mandatory attribute (as defined by the EOModel). So when the EC is saved, the new math class is what fails validation.

So, the delete fails validation, not because the deletion itself fails validation, but because EOs involved in the background business logic end up failing validation. EOF is doing the right thing and preventing the save, but the UI is never reporting the validation error nor reverting the EC, so the UI ends up showing that the related objects have been moved to the new EO and the original EO is gone. If you simply create a new session and fetch the objects again, you see that they are all back to the way they were before the attempted deletion.

In this situation, once I figured out that there was an effectively "swallowed" validation exception, and then _which_ object was causing it, I was able to fix my model so that this didn't throw the exception anymore and everything is working fine. BUT, this exception should be displayed in the UI.

Dave
 _______________________________________________
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

  • Follow-Ups:
    • Re: D2W Validation error "swallowed"
      • From: Ramsey Gurley <email@hidden>
  • Prev by Date: Re: D2W Business Logic triggered by a Delete
  • Next by Date: Re: D2W Validation error "swallowed"
  • Previous by thread: Re: D2W Business Logic triggered by a Delete
  • Next by thread: Re: D2W Validation error "swallowed"
  • Index(es):
    • Date
    • Thread