• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Halting a cocoa application?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

References: 
 >Halting a cocoa application? (From: Graham Reitz <email@hidden>)

  • Prev by Date: NSTextField in NSCollectionView aborts editing without notice, solved
  • Next by Date: Re: NSWindow CoreAnimation Delegate not being called
  • Previous by thread: Re: Halting a cocoa application?
  • Next by thread: Is there anything pathological with the following NSView simple subclass?
  • Index(es):
    • Date
    • Thread