• 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
Catch exception in NSArrayController
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Catch exception in NSArrayController


  • Subject: Catch exception in NSArrayController
  • From: Konrad Windszus <email@hidden>
  • Date: Thu, 17 Sep 2009 13:26:14 +0200

I have a classical binding usecase: A NSArrayController is used for displaying the columns of a NSTableView. The columns itself therefore use the arrangedObject method of the NSArrayController. In the get methods of the model itself (which normally return an NSString* which should be displayed in the column), there could occur an exception. I want to catch that exception in the NSArrayController. I therefore subclassed the NSArrayController and overwrote valueForKeyPath with a simple:

- (id)valueForKeyPath:(NSString *)keyPath {
try {
[super valueForKeyPath:keyPath];
}
catch (...) {
// want to get here, if there is an exception thrown within the model class
}
}


Unfortunately it is only called with arrangedObjects. At that point no exception is thrown yet. Somewhere after that a valueForKeyPath must be executed on that returned arrangedObjects. Since I have not subclassed this proxy class, I cannot intercept its valueForKeyPath method and therefore cannot catch the exception. Is there a simple way to catch exceptions in the controller class which is thrown during calling a get method (over binding mechanims)?
Thanks for any help.
Konrad
_______________________________________________


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


  • Follow-Ups:
    • Re: Catch exception in NSArrayController
      • From: Kyle Sluder <email@hidden>
    • Re: Catch exception in NSArrayController
      • From: "Sean McBride" <email@hidden>
  • Prev by Date: Send POST data to browser
  • Next by Date: Fwd: [SOLVED] NSTreeController setSelectionIndexPath depends on sort order
  • Previous by thread: Re: How to create subentity object inheriting from superentity object in core data
  • Next by thread: Re: Catch exception in NSArrayController
  • Index(es):
    • Date
    • Thread