Re: Debugging an ignored exception
Re: Debugging an ignored exception
- Subject: Re: Debugging an ignored exception
- From: Matt Neuburg <email@hidden>
- Date: Sat, 25 Nov 2006 12:41:37 -0800
- Thread-topic: Debugging an ignored exception
On Sat, 25 Nov 2006 19:09:38 +0200, Guy Meyer <email@hidden> said:
>
>My application logs the following to the console:
>
>*** NSRunLoop ignoring exception '***
>+[NSArray arrayWithObject:]: attempt to insert nil' that raised
>during posting of delayed perform with target 4e6c480 and selector
>'invokeWithTarget:'
As a test, I deliberately created an app that inserts nil into an Array and
therefore generates this message in the console:
2006-11-25 12:19:08.776 exceptionHandlingTest[8539] *** NSRunLoop ignoring
exception '*** -[NSCFArray addObject:]: attempt to insert nil' that raised
during posting of delayed perform with target 354350 and selector 'throwMe:'
Then I linked in the ExceptionHanding framework and added to the app
delegate's class the following material:
#import <ExceptionHandling/NSExceptionHandler.h>
- (void)applicationWillFinishLaunching:(NSNotification *)aNotification {
NSExceptionHandler *handler =
[NSExceptionHandler defaultExceptionHandler];
[handler setExceptionHandlingMask:NSLogAndHandleEveryExceptionMask];
[handler setDelegate: self];
}
- (BOOL)exceptionHandler:(NSExceptionHandler *)sender
shouldLogException:(NSException *)exception
mask:(unsigned int)aMask {
Debugger();
return NO;
}
Now when I run the app in the debugger I break and fall into the debugger,
and sure enough, in the appropriate stack frame I am paused right at the
line that inserted nil. You might be able to use some modification of this
technique. If you do a search in the cocoabuilder archives on
NSExceptionHandler you'll find a lot of interesting information on this
topic. m.
--
matt neuburg, phd = email@hidden, <http://www.tidbits.com/matt/>
A fool + a tool + an autorelease pool = cool!
AppleScript: the Definitive Guide - Second Edition!
<http://www.amazon.com/gp/product/0596102119>
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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