Re: Halting a cocoa application?
Re: Halting a cocoa application?
- Subject: Re: Halting a cocoa application?
- From: "Ken Ferry" <email@hidden>
- Date: Sat, 24 May 2008 21:04:35 -0700
On Sat, May 24, 2008 at 5:12 PM, Graham Reitz <email@hidden> wrote:
> What is the preferred method to halt a cocoa application on a runtime error
> occurring in the initWithFrame method?
For programming errors, like "you called me with inconsistent
arguments!", Cocoa typically uses exceptions. You can use NSAssert as
a convenience for throwing exceptions on supposedly unreachable
conditions.
For softer errors that the programmer cannot control and you'd like to
actually tell the user about, like inability to read a file from disk,
Cocoa uses NSError. These are user presentable errors, displayed in a
sheet most often, possibly with recovery options.
It sounds to me like you're in the first category. See
<http://developer.apple.com/documentation/Cocoa/Conceptual/Exceptions/Exceptions.html>
for more detail.
NSError is discussed at
<http://developer.apple.com/documentation/Cocoa/Conceptual/ErrorHandlingCocoa/ErrorHandling/chapter_1_section_1.html>.
-Ken
_______________________________________________
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