Re: Best way to programmatically cancel an NSError?
Re: Best way to programmatically cancel an NSError?
- Subject: Re: Best way to programmatically cancel an NSError?
- From: Matt Neuburg <email@hidden>
- Date: Mon, 24 Sep 2007 09:30:03 -0700
- Thread-topic: Best way to programmatically cancel an NSError?
On Fri, 21 Sep 2007 10:58:24 -0400, George Orthwein <email@hidden>
said:
>So I expect there is a standard way to suppress an NSError... but in
>case I'm doing something too unusual, I'll add some background...
>
>I have an interesting inter-property validation situation where I
>would like to deny a certain change to an object and instead handle
>it in my controller by creating a new object. (Sounds weird, I know,
>but it does actually make sense in context, I promise!). Since
>validate<Key>:error: is in the model, I thought it would make sense
>to deny the change and then use the NSError to pass the message to
>the controller layer. My NSDocument subclass can then catch the
>error, suppress it, and react appropriately.
>
>But how exactly should I suppress the error?
I'm not heavily experienced at this, but I've done quite a bit of using
NSErrors and I'm curious what "suppress the error" means. I'm accustomed to
doing one of two things:
* If I catch an NSError arriving thru the responder chain, I can create and
return a different NSError in willPresentError to substitute it as it heads
up the chain.
* If I catch the situation earlier, in validateXXX, I can create an NSError
and return NO, or just do whatever I like and return YES.
You seem to be talking about some further option, and I'm wondering what it
is. Thx - m.
--
matt neuburg, phd = email@hidden, <http://www.tidbits.com/matt/>
A fool + a tool + an autorelease pool = cool!
One of the 2007 MacTech Top 25: <http://tinyurl.com/2rh4pf>
AppleScript: the Definitive Guide - Second Edition!
<http://www.amazon.com/gp/product/0596102119>
_______________________________________________
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