Re: Crashing on all relevant exceptions
Re: Crashing on all relevant exceptions
- Subject: Re: Crashing on all relevant exceptions
- From: Aaron Jacobs <email@hidden>
- Date: Mon, 7 Aug 2006 14:59:01 -0700
(I apologize if this is a duplicate message. I've had some odd
problems with my mail server lately.)
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?
Does anyone have any sample code for this?
See OAApplication in OmniAppKit. At least, the last time I
downloaded it, they subclassed NSApplication...
_______________________________________________
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