Re: catching uncaught exceptions
Re: catching uncaught exceptions
- Subject: Re: catching uncaught exceptions
- From: Clark Cox <email@hidden>
- Date: Mon, 9 Feb 2004 14:31:55 -0500
On 2004/02/09, at 13:51, matt neuburg 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.
Exceptions that are raised when responding to a notification do not
propagate outside of the notification, so NSApplication never sees
them. If you want to display an alert, then catch these exceptions
before they propagate outside of your notification method, and call
[NSApp reportException: ] yourself.
--
Clark S. Cox III
email@hidden
http://homepage.mac.com/clarkcox3/
http://homepage.mac.com/clarkcox3/blog/B1196589870/index.html
[demime 0.98b removed an attachment of type application/pkcs7-signature which had a name of smime.p7s]
_______________________________________________
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.