NSException is raised but disappears
NSException is raised but disappears
- Subject: NSException is raised but disappears
- From: Paul Suh <email@hidden>
- Date: Mon, 2 Jul 2007 17:00:00 -0400
Folks,
I'm running into an odd one. I am calling a method in a framework,
and it raises an exception in a subclass of NSException. I put a
breakpoint on [NSException raise], and the exception is definitely
being raised. However, the associated @catch block never fires, and
the exception seems to just be discarded. I installed a delegate and
set masks in NSExceptionHandler, and those never saw the exception
either.
Details:
I am trying to use the framework DSObjCWrappers, which is in /System/
Library/PrivateFrameworks. I understand that these are unsupported,
I'm not supposed to use them directly, yada yada yada. However, this
problem seems to be something more fundamental, so I'm plowing ahead.
Also, DSObjCWrappers is part of the Darwin distribution, in the
DSTools project, so we can legitimately get access to the source code.
That said, I've reduced the issue to a simplified test case. In
WindowController.m, the method lookupUser: calls [DSoNode findUser:].
That in turn calls [DSoNode _findRecord:ofType:] which raises the
exception with [DSoException raiseWithStatus:] if it can't find the
user in the directory node. This is all well and good. However, the
exception disappears, the @finally block is executed, and the
execution continues with the next line of code.
To set up the DSObjCWrappers for debugging, you need to download the
DSTools-60.1 project from Apple at <http://www.opensource.apple.com/
darwinsource/Current/>. Select the DSObjCWrappers target and make
sure that the "Generate debugging ymbols" option is selected, that
the optimization level is set to -O0, and that -fobjc-exceptions flag
is in the Other C Complier Flags, then build the DSObjCWrappers
target. Move the existing /System/Library/PrivateFrameworks/
DSObjCWrappers.framework aside and then copy the newly built
framework from $(SRCROOT)/build/Development/ to /System/Library/
PrivateFrameworks. (You can't just add the newly built framework to
the example application, as for some reason the framework in the /
System/Library/PrivateFrameworks directory is always picked up first
by the linker.)
Next, download my example app from <http://ps-enable.com/Members/
plsuh/ODAPITest.zip> Unzip the project and make sure that the
DSObjCWrappers framework item has the proper path. Set appropriate
breakpoints and test it with a user and/or group that is not in your
local NetInfo database. Watch the exception fire, watch the exception
vanish into the bit bucket.
I'm fresh out of ideas -- anybody have a clue as to what's going on?
--Paul
Paul Suh
http://www.ps-enable.com/
email@hidden (240) 672-4212
Attachment:
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________
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