Best way to programmatically cancel an NSError?
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