gnustep-dev
[Top][All Lists]
Advanced

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

Re: Allowing Applications to continue after exception...


From: Gregory Casamento
Subject: Re: Allowing Applications to continue after exception...
Date: Sat, 7 Feb 2009 22:06:04 -0500

Here is the promised patch.   Please take a look and give any feedback you can.

This is simply a patch to allow the user to set whether or not they want to debug exceptions or not.  The default is NO at present so the exceptions will simply be logged as they are in Cocoa.

I am going to go ahead and commit this change fairly soon (probably early tomorrow morning) after I do more testing.  If it causes problems for anyone then we can revert it.  I know this goes a bit against what I said earlier (about sending a patch), but I would like to get this in very soon and it's easier for people to examine if it's in the repository.

Later, GC

On Fri, Feb 6, 2009 at 2:40 PM, Gregory Casamento <address@hidden> wrote:
My test application doesn't link with the ExceptionHandling framework at all....

So, it looks like we have two things going on here under Cocoa/OpenStep:

1) The standard/default exception handler generally just logs the exception and continues... as illustrated by my example code.
2) The ExceptionHandling.framework allows us to handle exceptions in a more finely grained manner by replacing the standard/default exception handler with one that can talk to the delegate.  (if the application links with the ExceptionHandling.framework)

So it seems that implementing part 1 and 2 are not interdependent on one another.

Is anyone else getting that impression?

GC


On Fri, Feb 6, 2009 at 10:51 AM, Wolfgang Lux <address@hidden> wrote:
Gregory Casamento wrote:

What should "NSExceptionMask" be implemented as?  SHould it be a boolean that determines if we should allow the application to continue or not?

That is to say
* NSExceptionMask = YES  - report all exceptions, but continue anyway...
* NSExceptionMask = NO - current behavior

If so, I have a patch almost ready.  I'll submit it to the group prior to committing it since a change that is this important needs to have some amount of consensus.

Have a look at Apple's ExceptionHandlingFramework, which is described here:

 http://developer.apple.com/documentation/Cocoa/Reference/ExceptionHandlingFramework/index.html

Implementation of this framework looks very straight forward, and I guess that they simply install the defaultExceptionHandler in the event loop of NSApplication.

The NSExceptionHandlingMask (not NSExceptionMask!) default is described in the accompanying guide that Richard mentioned already:

 http://developer.apple.com/documentation/Cocoa/Conceptual/Exceptions/Exceptions.html

In particular, see the section "Controlling a Program's Response to Exceptions".

Essentially, NSExceptionHandlingMask is a bit mask that controls whether uncaught exceptions, uncaught system exceptions, and runtime errors are logged and/or handled. The important values (quoted from the above document) are

 #define NSLogUncaughtExceptionMask 1
 #define NSHandleUncaughtExceptionMask 2
 #define NSLogUncaughtSystemExceptionMask 4
 #define NSHandleUncaughtSystemExceptionMask 8
 #define NSLogRuntimeErrorMask 16
 #define NSLogUncaughtRuntimeErrorMask 32

Wolfgang




--
Gregory Casamento
Open Logic Corporation, Principal Consultant
## GNUstep Chief Maintainer
yahoo/skype: greg_casamento, aol: gjcasa
(240)274-9630 (Cell), (301)362-9640 (Home)




--
Gregory Casamento
Open Logic Corporation, Principal Consultant
## GNUstep Chief Maintainer
yahoo/skype: greg_casamento, aol: gjcasa
(240)274-9630 (Cell), (301)362-9640 (Home)

Attachment: NSApplication.m.patch
Description: Text Data


reply via email to

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