Re: What is the expected Cocoa API behavior in an incomplete object traversal?
Re: What is the expected Cocoa API behavior in an incomplete object traversal?
- Subject: Re: What is the expected Cocoa API behavior in an incomplete object traversal?
- From: Tito Ciuro <email@hidden>
- Date: Fri, 15 Oct 2010 17:30:46 -0300
Hi Corbin,
On 15/10/2010, at 16:55, Corbin Dunn wrote:
> If it is instead some array input that the user provided, and it is a user error to provide the wrong input, then you should return a user-presentable NSError and the caller should present the error on failure.
This sounds right to me.
Well, in a normal situation the array would contain conforming objects. However, as it can happen once in a while, one can add an object to an array thinking it's of one type when in fact it's another. Currently, the method detects this anomaly and skips it while continuing traversing the array. It then fills an NSError (as long as the user cares) and returns NO. This is the method I'm talking about:
- (BOOL)addObjectsFromArray:(NSArray *)someObjects error:(out NSError **)outError;
I wonder if returning a BOOL and filling out an NSError is a bit too much though...
Thanks to everyone who have responded,
-- Tito
_______________________________________________
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