Leopard exception handling driving me crazy!
Leopard exception handling driving me crazy!
- Subject: Leopard exception handling driving me crazy!
- From: Gerd Knops <email@hidden>
- Date: Fri, 12 Sep 2008 12:34:17 -0500
OK, so:
[[NSExceptionHandler defaultExceptionHandler]setDelegate:self];
[[NSExceptionHandler defaultExceptionHandler]setExceptionHandlingMask:
0
| NSHandleUncaughtExceptionMask
| NSHandleUncaughtSystemExceptionMask
| NSHandleUncaughtRuntimeErrorMask
// | NSHandleTopLevelExceptionMask
];
If I include "NSHandleTopLevelExceptionMask", my nested exception
handlers do NOT get called and it jumps right to the delegates '-
exceptionHandler:shouldHandleException:mask:' method (mask being 128,
NSHandleTopLevelExceptionMask). It catches the exception deep down in
the code, even though there are 2 levels of handlers around it.
If I don't include NSHandleTopLevelExceptionMask, the nested handlers
get executed (they are throwing other exceptions containing more
information and referencing the original exception), but the exception
finally reaching the delegate is not the exception thrown at my top-
level handler (and it definitely is being thrown), but rather this
less than useful:
Uncaught system exception: signal 5
with no apparent access to that last exception my code actually
generated. The mask reported is 8, NSHandleUncaughtSystemExceptionMask.
Now what I was expecting is that with NSHandleTopLevelExceptionMask
included, the handler would only receive exceptions escaping my top
level exception handler, rather than the 'original' exception deep
down in the code.
Where am I going wrong?
Thanks
Gerd
_______________________________________________
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