Re: Exception handling
Re: Exception handling
- Subject: Re: Exception handling
- From: Georg Seifert <email@hidden>
- Date: Thu, 14 Jun 2018 15:03:32 -0400
The hockeyApp framework has a lot explanation about this:
https://www.hockeyapp.net/help/sdk/mac/4.0.2/Classes/BITCrashExceptionApplication.html
Best
Georg Seifert
> Am 14.06.2018 um 14:33 schrieb Casey McDermott <email@hidden>:
>
> Thanks, this is all useful info. I checked NSExceptionHandler and
> NSUncaughtExceptionHandler, but they are just for logging before termination.
> NSRunLoop is accessible but there's not much there.
>
> However, simply replacing the C++ throw with a Cocoa exception via
> [NSException raise : errString format : errString]; seems to work great.
> Apparently it unwinds the call stack and is swallowed in the run loop.
>
> It doesn't use the error string but that's fine. We already show a dialog
> before the throw, with file & line number. Helps enormously for fixing bugs.
>
> Thanks for all the help,
>
> Casey McDermott
>
> --------------------------------------------
> On Thu, 6/14/18, Alastair Houghton <email@hidden> wrote:
>
> Subject: Re: Exception handling
> To: "Jens Alfke" <email@hidden>
> Cc: "Casey McDermott" <email@hidden>, "cocoa-dev list"
> <email@hidden>
> Date: Thursday, June 14, 2018, 1:11 PM
>
> On 14 Jun
> 2018, at 18:00, Jens Alfke <email@hidden>
> wrote:
>
> On Jun 13, 2018, at 7:22
> PM, Casey McDermott <email@hidden>
> wrote:
>
> Our Carbon event loop had
> a try/catch block, which caught most exceptions, and then
> continued. It started
> as an expedient in early production, but it remained in
> production code
> since
> it often allows users to continue, save their work, etc.
>
>
> That's actually how
> Cocoa used to work. I can't recall whether an alert
> panel popped up or if it was just silent. The behavior
> changed to crashing sometime in the past, um, 8 years or
> so.
>
> I don’t
> think it’s changed in any obvious way; the framework has
> always swallowed exceptions in certain contexts, but not in
> others. Obviously the precise detail may have changed over
> time, but it’s certainly crashed on exceptions for as long
> as I remember, outside of the places where they get ignored
> for whatever reason.
> Is there a way to override
> the event loop in Cocoa? Some other way we can escape to
>
> the event loop and
> then continue from there?
>
> There used to be either a callback or
> an overridable NSApplication method to handle an uncaught
> exception, but looking at current headers I can't find
> what I'm looking for; maybe it's been gone for a
> long time and removed?
>
> Perhaps
> you’re thinking of NSSetUncaughtExceptionHandler()? I
> don’t think there’s much you can usefully do from that,
> though, besides logging the exception.
> Kind regards,
> Alastair.
> --http://alastairs-place.net
>
> _______________________________________________
>
> 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