Re: Cocoa Error Handling (remix)
Re: Cocoa Error Handling (remix)
- Subject: Re: Cocoa Error Handling (remix)
- From: Shawn Erickson <email@hidden>
- Date: Mon, 12 Apr 2004 16:10:34 -0700
On Apr 12, 2004, at 3:44 PM, Hua Ying Ling wrote:
In interest of building more robust applications which return
informative error messages, I've been looking into error handling
techniques.
From this thread:
<http://cocoa.mamasam.com/MACOSXDEV/2002/10/1/46831.php>, I gather I
should rarely use NSException. Would someone give me more examples of
situations that fall under this category: (quoting Erik M. Buck from
above thread: ... Exceptions should be used as a last opportunity to
handle a situation that should _never_ happen ...
It looks like I should now use NSErrors? Which domain should I use
since there doesn't seem to be a Cocoa domain?
Are there any articles, sample code, or books on error handling that
you would recommend?
Exceptions are just that, exceptions to expected normal operation or
flow of a program. You should use them (throw/raise) if the "error"
falls into that type of category. You should also consider catching
them as appropriate. It is a hard thing to answer since what is normal
for one may not be normal for another.
-Shawn
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.