discuss-gnustep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Exceptions in GNUstep


From: Ivan Vučica
Subject: Re: Exceptions in GNUstep
Date: Sat, 3 Aug 2013 15:14:15 +0200

Hi Fred,

On Fri, Aug 2, 2013 at 4:50 PM, Fred Kiefer <fredkiefer@gmx.de> wrote:

please have a look at this method in NSApplication:

- (void) _handleException: (NSException *)exception

As you can see it gets the mask for exception handling from the
defaults. My current setting there is 3, which means I get a log and the
exception ends up in a panel. This is the best setting for a development
environment, but not what you want on a user desktop.

I've also looked at this method, since AppKit's interception of exceptions complicates debugging -back.

It looks like setting NSExceptionHandlerMask to 1 in NSGlobalDomain.plist does not prevent AppKit's exception handler from kicking in (and trying to show the alert panel), and setting it to 0 does not help either.

Nothing is logged in my case before the alert display code in _NSAppKitUncaughtExceptionHandler() kicks in.

I propose a change to _NSAppKitUncaughtExceptionHandler() to add NSLog(@"Unhandled exception: %@", exception); just before the call to GSRunExceptionPanel() (but after the possible bailing out in case current context is nil).

Any objections?

I'll be happy to commit the following diff:

Index: Source/NSApplication.m
===================================================================
--- Source/NSApplication.m (revision 36941)
+++ Source/NSApplication.m (working copy)
@@ -131,6 +131,8 @@
       [exception raise];
     }
 
+  NSLog(@"Unhandled exception: %@", exception);
+
   retVal = GSRunExceptionPanel 
     ([NSString stringWithFormat: _(@"Critical Error in %@"),
        [[NSProcessInfo processInfo] processName]],


--
Ivan Vučica
ivan@vucica.net

reply via email to

[Prev in Thread] Current Thread [Next in Thread]