Hey James,

> On May 28, 2021, at 6:54 PM, James Walker via Cocoa-dev 
> <cocoa-dev@lists.apple.com> wrote:
> 
> When an uncaught exception is raised, I want to log some information about it 
> but let it continue on as normal.  But when I use NSExceptionHandler, an 
> uncaught exception displays an "Internal Error" modal dialog with buttons 
> "Show Details", "Crash", and "Continue".  I don't see any explicit mention of 
> this dialog in the API docs for NSExceptionHandler or in the "Exception 
> Programming Topics" guide.  I suppose that is what is meant when the 
> documentation of the method setExceptionHangingMask: talks about cases that 
> will "halt execution for debugging".  But I set this mask to 0, so I would 
> think it would never show the dialog, yet it does.  I have an 
> NSExceptionHandlerDelegate whose delegate methods always return NO, meaning 
> do not handle or log the exception.  Is there any way to just watch 
> exceptions go by without showing this dialog?

Without commenting on the wisdom of blowing past exceptions 😉, I’ll note that:

1. NSExceptionHandler doesn’t allow you to prevent uncaught exceptions (whether 
truly uncaught or caught by one of AppKit’s last-resort catches) from being 
reported to +reportException:.  It in fact goes out of its way to make sure it 
does not impede this

2. Buuuut… the default behavior in Cocoa of an uncaught exception is to ignore 
it.  You’re seeing this dialog because you have the user default 
`NSApplicationShowExceptions` set somewhere.  (Use `defaults find` to help find 
out where.)  It’s not on by default, but you may have turned it on at some 
point because of the aforementioned wisdom

HTH,

Matt
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to