In article ,
Santa Claus wrote:
> agreed, this brings me to the other point. how do i trap the
> exception? is it with the notification manager or exception manager?
> the exception manager appears to be intended to send exceptions not
> receive them.
>
> oh, i wish for the good old days of simply checking the ioresult and
> determining what it was and acting on it that way. write a file, disk
> gets full and it doesn't write and then sends back an error to the
> method that called it and that method can handle it directly instead of
> indirectly.
ok, i found out why i can't find any references to the exception
manager, it wasn't included in my project frameworks. i added that and
then found out a whole bunch of things and got it to trap the error.
when i return the BOOL of NO, it continues to crash the program. when i
return YES, it doesn't crash the program but doesn't resume the thread
where it left off either. yes, i know i need to actually TEST for the
proper exception to handle it properly but this is a short and dirty
test to see what's supposed to happen.
- (BOOL)exceptionHandler: (NSExceptionHandler *) sender
shouldHandleException: (NSException *) exception
mask: (unsigned int) aMask;
{
NSLog(@"ignore the above exception, it's being handled.");
NSLog(@"exception sender = %@", sender);
NSLog(@"exception = %@", exception);
NSLog(@"exception mask = %ld", aMask);
// these things i added to try to close the thread properly since it
didn't close properly with just the return.
[self echotext: [NSMutableString stringWithString: @"done with zeroize
function\n"]];
[mapWindowPool release];
return YES;
}
NSExceptionHandler *handler = [NSExceptionHandler
defaultExceptionHandler];
[handler setExceptionHandlingMask: NSHandleUncaughtExceptionMask];
[handler setDelegate: self];
>> Stay informed about: catching exceptions help needed.