Hello,

on a second thinking, I found a solution which fits my own 
wishlist better:


+ (void) raise: (NSString*)name
        format: (NSString*)format
      arguments: (va_list)argList
{
   static BOOL recursionCheck = NO;
   NSString     *reason;
   NSException  *except;

//fprintf(stderr, "NSException: %s\n", [name cString]); fflush(stderr);

   if (recursionCheck)
     {
       fprintf(stderr, "Recursive Exception detected.\n");
       fprintf(stderr, "Name: %s\nReason: ", [name cString]);
       vfprintf(stderr, [format cString], argList);
       fprintf(stderr, "\n");
       fflush(stderr);
//      abort();
     } else {
       /* This potentially raises an exception again. recursionCheck
          protects against endless recursion. */
       recursionCheck = YES;
       reason = [NSString stringWithFormat: format arguments: argList];
       recursionCheck = NO;
       except = [self exceptionWithName: name reason: reason 
userInfo: nil];
       [except raise];
     }
}


Simply removing the abort() ended the recursion after three 
loops but allowed more exceptions. Surprise! Who resets 
recusionCheck? Are there more than one
instances of the NSException class?

With the first fprintf() uncommented, I get:

NSException: NSGenericException
NSException: NSGenericException
Recursive Exception detected.
Name: NSGenericException
Reason: subclass NSConstantString(instance) should override length
NSException: NSGenericException
Recursive Exception detected.
Name: NSGenericException
Reason: subclass NSConstantString(instance) should override length
NSException: NSGenericException
Recursive Exception detected.
Name: NSGenericException
Reason: subclass NSConstantString(instance) should override length
NSException: NSGenericException
NSException: NSGenericException
Recursive Exception detected.
Name: NSGenericException
Reason: subclass NSConstantString(instance) should override length
NSException: NSGenericException
Recursive Exception detected.
Name: NSGenericException
Reason: subclass NSConstantString(instance) should override length
NSException: NSGenericException
Recursive Exception detected.
Name: NSGenericException
Reason: subclass NSConstantString(instance) should override length
Uncaught exception , reason:


You notice the second double of "NSException: 
NSGenericException" around the middle?

But then, this might be a result of something completely else.



Have fun,
Markus

- - - - - - - - - - - - - - - - - - -
Dipl. Ing. Markus Hitter
http://www.jump-ing.de/



_______________________________________________
Bug-gnustep mailing list
[EMAIL PROTECTED]
http://mail.gnu.org/mailman/listinfo/bug-gnustep

Reply via email to