Re: Recovering from a merge conflict
Re: Recovering from a merge conflict
- Subject: Re: Recovering from a merge conflict
- From: Paulo Andrade <email@hidden>
- Date: Tue, 21 Dec 2010 17:29:38 +0000
On Dec 21, 2010, at 3:08 PM, Fritz Anderson wrote:
> On 21 Dec 2010, at 8:36 AM, Paulo Andrade wrote:
>
>> int tries = 10;
>> while ( tries-- ) {
>> // compute this batch
>>
>> [moc save:&error];
>> if (error != nil && [error code] == NSManagedObjectMergeError) {
>
> This may not be your main problem, but you should never inspect a returned error object unless the method that returned it reports a failure:
>
> if (! [moc save: &error] && [error code] == NSManagedObjectMergeError) {
> ...
>
> Such methods are free to set the error object at their start, in case they fail, but the error is correct only if the method does fail.
>
> — F
>
Thanks for noticing that, actually did not know about that. Is that written anywhere on Apple's docs?
It's not that consistent either, take executeFetchRequest:error: for example. But yes, I understand that I should first use the method error reporting if it exists before delving in the NSError object.
Anyway, back to the original question.. anyone?_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden