On Nov 11, 2009, at 5:35 PM, James Walker wrote:

> I had a situation where removeObserver:forKeyPath: was called twice for the 
> same receiver (an NSUserDefaultsController), the same observer, and the same 
> key path.  It threw an NSRangeException.  But the KVO docs don't say anything 
> about removeObserver:forKeyPath: throwing an exception.  Should this be 
> considered a documentation bug, or is it a bug that 
> -[NSUserDefaultsController removeObserver:forKeyPath:] threw an exception, or 
> should I have just expected this due to some general principle?

Cocoa reserves the use of exceptions for programming errors an unexpected 
runtime errors.

Trying to remove an observer for a key path which has already been removed (or 
never registered) falls into the programming error class, so I wouldn’t expect 
this to be explicitly documented.

Jim

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to