• 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: Crashing on all relevant exceptions
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Crashing on all relevant exceptions


  • Subject: Re: Crashing on all relevant exceptions
  • From: Chris Suter <email@hidden>
  • Date: Mon, 7 Aug 2006 16:34:16 +1000


On 07/08/2006, at 8:31 AM, Aaron Jacobs wrote:

I've searched on and off for a long time now for a way to do this, but have never found a posting or discussion thread that deals with it directly and has a solution.

I subscribe to the idea of using assertions in particular and exceptions in general to "crash early" (in the words of The Pragmatic Programmer). The problem I have is that, as I've gathered, NSApp uses its own exception handler when the run loop executes code as a result of an event. This handler seems to just log exceptions that it catches, instead of brining the program down as I'd like. For example, if I put NSAssert(NO, @"Blah.") in a method that is hooked up to a button in the interface, I get this when I click the button:

2006-08-06 15:21:27.567 Test App[9111] *** Assertion failure in - [TestClass test:], /Users/ajacobs/Desktop/TestClass.m:15
2006-08-06 15:21:27.568 Test App[9111] Blah.


That's not good enough for me; I'd like the program to crash so that if the bug makes it into a production version my users notice and send me crash reports. I've messed around with the ExceptionHandling framework, but unless I missed something it does not allow you to make the application crash on this kind of exception.

Is there any way to disable or preempt this exception handler and any other ones Cocoa may use that are contrary to my goal?

What about installing your own assertion handler? Have you seen NSAssertionHandler? It looks like you should be able to make it do something different when an assertion fails.


- Chris


Attachment: smime.p7s
Description: S/MIME cryptographic signature

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >Crashing on all relevant exceptions (From: Aaron Jacobs <email@hidden>)

  • Prev by Date: Re: Crashing on all relevant exceptions
  • Next by Date: Re: Unlocalises displayName for NSFont?
  • Previous by thread: Re: Crashing on all relevant exceptions
  • Next by thread: Re: Crashing on all relevant exceptions
  • Index(es):
    • Date
    • Thread