• 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
Re: try catch not working
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: try catch not working


  • Subject: Re: try catch not working
  • From: Sacha Mallais <email@hidden>
  • Date: Mon, 13 Jun 2005 13:22:49 -0700

On Jun 13, 2005, at 12:55 PM, Amedeo Mantica wrote:

Worked, thanks!

I have also defined a validateForSave method, but why it doesn't throw the exception?

Validation errors are errors according to the model. EOGeneralAdaptorExceptions are errors according to the database. Ideally, these would agree 100%, but there are certain database problems that are not the concern of the model (optimistic locking, for example).

In your case, your model differs from your database: you should make the attribute that corresponds to the price column be required. Then you will see validation errors when you leave the price blank...


sacha


On 13/giu/05, at 19:23, James E. Stead wrote:

Then you need a

catch ( EOGeneralAdaptorException e )




On Jun 13, 2005, at 1:20 PM, Amedeo Mantica wrote:

this is the exception:


com.webobjects.eoaccess.EOGeneralAdaptorException: EvaluateExpression failed: : Next exception:SQL State:HY000 -- error code: 1048 -- msg: Column 'price' cannot be null



On 13/giu/05, at 19:14, James E. Stead wrote:

Is it the same exception class?

On Jun 13, 2005, at 1:08 PM, Amedeo Mantica wrote:

Hi

I have thie piece of cone for inserting ad object from my editing context into the database

        try
        {
            System.out.println("Saving Object");
            ec.saveChanges();
        }
        catch (NSValidation.ValidationException ve)
        {
            // caught an exception on save.
            System.out.println("Errors present");
            errorsPresent = true;
            errorString = (String) ve.key();
            return null;
        }

worked very well, but now with Xcode 2.1 if there are errors in the savechanges routine WO display me the expeption error intead to go to the catch code.
Does anyone have suggestion?
Thanks


AMEDEO
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40mac.com


This email sent to email@hidden


James E. Stead
407.252.3321
email@hidden





James E. Stead
407.252.3321
email@hidden



_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40global-village.net


This email sent to email@hidden

_______________________________________________ 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
References: 
 >try catch not working (From: Amedeo Mantica <email@hidden>)
 >Re: try catch not working (From: Amedeo Mantica <email@hidden>)
 >Re: try catch not working (From: Amedeo Mantica <email@hidden>)

  • Prev by Date: Re: try catch not working
  • Next by Date: Re: try catch not working
  • Previous by thread: Re: try catch not working
  • Next by thread: Re: try catch not working
  • Index(es):
    • Date
    • Thread