• 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: Aaron Jacobs <email@hidden>
  • Date: Mon, 7 Aug 2006 13:48:00 -0700

Does anyone have any sample code for this?

See OAApplication in OmniAppKit. At least, the last time I downloaded it, they subclassed NSApplication...


Thanks for this. By inspecting it, I was able to find that the following code in a subclass of NSApplication does almost what I want:

- (void)run;
{
	NS_DURING
	{
		[super run];
		NS_VOIDRETURN;
	}
	NS_HANDLER
	{
		NSLog(@"Dying on exception: %@", localException);
//		[localException raise];
	}
	NS_ENDHANDLER;
}


This will correctly cause the program to die if an exception is raised, even if it happens during the processing of an event. However, it causes the program to just quit with an exit status of zero, which doesn't indicate to the system that it has crashed, so e.g. the crash reporter window doesn't come up.


If I uncomment the line that re-raises the exception, then the program correctly crashes. However, the crash report indicates that it happened at that line in the run method, rather than on the line that initially raised the exception. I would rather have a crash report giving a correct stack trace.

Does anyone know how to get around this problem?

I'm actually surprised that code even works as well as it does -- shouldn't NSApplication's own exception handler be nested deeper than that and thus take priority? Maybe it doesn't install an exception handler if there's already an existing one? Does anyone know why this works?
_______________________________________________
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
  • Follow-Ups:
    • Re: Crashing on all relevant exceptions
      • From: Shaun Wexler <email@hidden>
References: 
 >Crashing on all relevant exceptions (From: Aaron Jacobs <email@hidden>)
 >Re: Crashing on all relevant exceptions (From: Nick Zitzmann <email@hidden>)
 >Re: Crashing on all relevant exceptions (From: Aaron Jacobs <email@hidden>)
 >Re: Crashing on all relevant exceptions (From: Nick Zitzmann <email@hidden>)

  • Prev by Date: Re: Crashing on all relevant exceptions
  • Next by Date: Re: Xcode version
  • Previous by thread: Re: Crashing on all relevant exceptions
  • Next by thread: Re: Crashing on all relevant exceptions
  • Index(es):
    • Date
    • Thread