• 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
Best way to programmatically cancel an NSError?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Best way to programmatically cancel an NSError?


  • Subject: Best way to programmatically cancel an NSError?
  • From: George Orthwein <email@hidden>
  • Date: Wed, 19 Sep 2007 16:20:08 -0400

I'm wondering how I can best programmatically cancel an NSError. It seems I should be looking at willPresentError: but I can't find the way. I first tried returning NULL in willPresentError: but that still resulted in an empty alert appearing. I did find some mention of NSUserCancelledError but I'm not sure if that should be reserved just for user canceling. I've looked through the Error Handling Guide but I'm missing where this may be addressed.

Currently, I am overriding presentError:modalForWindow:... in my document subclass which seems to work fine, but the docs frown on overriding this method. (Not that I'm really messing with it since I just call super.):

- (void)presentError:(NSError *)error modalForWindow:(NSWindow *) window delegate:(id)delegate didPresentSelector:(SEL) didPresentSelector contextInfo:(void *)contextInfo
{
if ([[error domain] isEqualToString:<my apps's unique domain>]==YES) {
//suppress error
} else {
// pass error on up the chain
[super presentError:error modalForWindow:window delegate:delegate didPresentSelector:didPresentSelector contextInfo:contextInfo];
}
}



Just wondering if I'm missing a better way.

Thanks,
George
_______________________________________________

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: Best way to programmatically cancel an NSError?
      • From: George Orthwein <email@hidden>
  • Prev by Date: Re: Spy++ for Cocoa/Mac OS X?
  • Next by Date: Re: Masking Tracking Rects
  • Previous by thread: calling willChangeValueForKey on NSManagedObject causes fetch of unrelated to-many relationships
  • Next by thread: Re: Best way to programmatically cancel an NSError?
  • Index(es):
    • Date
    • Thread