Re: NSApplicationShowExceptions - useful on main thread only?
Re: NSApplicationShowExceptions - useful on main thread only?
- Subject: Re: NSApplicationShowExceptions - useful on main thread only?
- From: Corbin Dunn <email@hidden>
- Date: Mon, 24 Sep 2012 10:52:40 -0700
On Sep 21, 2012, at 10:38 PM, Ken Thomases <email@hidden> wrote:
> On Sep 21, 2012, at 5:20 PM, Sean McBride wrote:
>
>> The 10.7 release notes say:
>>
>> "AppKit now has the ability to report uncaught exceptions. It is controlled by a user default: NSApplicationShowExceptions (YES/NO)...."
>>
>> My next version will require 10.7+, so I'm finally taking a look at this thing.
>>
>> It seems that it only works for the main thread, that is, if there's an uncaught exception on the main thread I get the nice error UI. But if an uncaught exception occurs on a non-main-NSThread or dispatch queue I get no nice UI.
>>
>> Can anyone confirm/deny? Anyone shipping with NSApplicationShowExceptions=YES?
>
> I have no inside knowledge, but I think you've misunderstood the purpose of this default. It's simply to change the behavior where AppKit would silently swallow exceptions which reached the event loop. Of course this only applies to the main thread, because that's the only thread which does that.
Yeah, all the option does is implement some code in NSApp's reportException if the user default is turned on.
corbin
>
> The new default is described as a tool for developers during development. I wouldn't necessarily argue that it _shouldn't_ be enabled for a release version of your app, but it's not really an end-user feature.
>
> If you want to change how uncaught exceptions are handled more generally, you should look into Exception Programming Topics: Controlling a Program’s Response to Exceptions <https://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/Exceptions/Tasks/ControllingAppResponse.html> and NSExceptionHandler. Of course, you should first strive to make sure your app doesn't raise exceptions, but no amount of programming care or testing can guarantee that it can never happen in the field.
>
> Regards,
> Ken
>
>
> _______________________________________________
>
> Cocoa-dev mailing list (email@hidden)
>
> Please 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
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please 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