RE: Professional Error Handling
RE: Professional Error Handling
- Subject: RE: Professional Error Handling
- From: Dick Bridges <email@hidden>
- Date: Mon, 26 Oct 2009 12:57:57 -0700
- Acceptlanguage: en-US
- Thread-topic: Professional Error Handling
> -----Original Message-----
> From: Alastair Houghton [mailto:email@hidden]
> Sent: Monday, October 26, 2009 4:02 AM
> To: Dick Bridges
> Cc: Squ Aire; email@hidden
> Subject: Re: Professional Error Handling
>
> On 25 Oct 2009, at 22:44, Dick Bridges wrote:
>
> > FWIW, there are some people (myself included) that consider "error
> > numbers" to be something of an anti-pattern when exception handling
> > is available.
>
> There are also some people (myself included) that consider that you
> are wrong.
>
> This has been discussed before on this very mailing list, so probably
> no need to start the debate again---just search the archives if you're
> interested.
>
> Kind regards,
>
> Alastair.
IIUC, http://developer.apple.com/mac/library/documentation/Cocoa/Conceptual/Exceptions/Exceptions.html is available to everyone and is not under NDA. It's the "Introduction to Exception Programming Topics for Cocoa". As noted on this page, the first article is titled "Exceptions and the Cocoa Frameworks" and "...describes NSException objects and their general use with the Cocoa frameworks." The page also contains a reference to the related CoreRecipes sample code. The document applies to both iPhone OS and Mac OS X. (FWIW, I am believe that exception handling is also used *->within<-* some or all of the core frameworks.)
When discussing the relative merits of exceptions and error codes, the distinction between "expected" and "unexpected" errors (i.e., exceptions) must be maintained. Apple's "Error Handling Programming Guide for Cocoa" does an excellent job of describing "...the recommended way to communicate *->expected<-* errors in Cocoa applications" (emphasis added).
The original question from Squ Aire contained a reference to the option of returning nil. It may well be that I misunderstood, but I interpreted that as exception handling and not the communication of normal, expected errors.
BTW, I did not neglect to research the archives. I did, however, fail to find related references to the above cited Apple developer documents. Might be some sloppy searching on my part. I'll go back and look again.
Regards,
Dick
_______________________________________________
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