Re: catching uncaught exceptions
Re: catching uncaught exceptions
- Subject: Re: catching uncaught exceptions
- From: Gus Mueller <email@hidden>
- Date: Mon, 9 Feb 2004 12:24:57 -0800
matt neuburg (email@hidden) wrote:
>
I want to override Cocoa's policy of failing silently with a note to the
>
Console when there is an exception, so I have created an NSApplication
>
subclass and implemented reportException: to call NSRunAlertPanel and tell
>
the user.
>
>
But it isn't working. When I deliberately generate an out-of-bounds range
>
error in my code, it winds up in the Console log and there is no alert
>
panel:
>
>
Exception raised during posting of notification. Ignored. exception: ***
>
-[NSCFString rangeOfString:options:range:]: Range or index out of bounds
>
>
What might I be doing wrong here? Thx - m.
I just tried this and got it to work- did you set your NSApplication
subclass in Info.plist's NSPrincipalClass?
<key>NSPrincipalClass</key>
<string>MyApp</string>
Here's what my app sublcass looks like:
@implementation MyApp
- (void)awakeFromNib {
[[NSArray array] objectAtIndex:100];
}
- (void)reportException:(NSException *)anException {
NSLog(@"exception!");
NSLog(@"bummer: %@", anException);
}
@end
-gus
--
August 'Gus' Mueller
Flying Meat Inc.
http://flyingmeat.com/
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.