Silent Self-Caught Exceptions vs. "All Exceptions" Breakpoint
Silent Self-Caught Exceptions vs. "All Exceptions" Breakpoint
- Subject: Silent Self-Caught Exceptions vs. "All Exceptions" Breakpoint
- From: Jerry Krinock <email@hidden>
- Date: Wed, 25 Sep 2013 09:19:48 -0700
Yesterday I switched on the "All Exceptions" breakpoint in Xcode.
It breaks when my app executes an AppleScript which asks Safari for the url of its front document, if there are no windows open in Safari. But my code can handle if the answer is nil, and everything continues to execute just fine.
I've tried to catch the exception using this code…
@try {
// script is an NSAppleScript instance
frontUrl = [[script executeAndReturnError:NULL] stringValue] ;
}
@catch (NSException* exception) {
NSLog(@"Exception! %@", exception) ;
}
but that NSLog never logs, and moreover Cocoa does not log anything either. I think this means that the NSAppleScript implementation catches the error, decides that it's trivial, and does nothing. Furthermore, the call stack [1] does not suggest any interesting parameters in registers.
I think my options are…
• For this special case, modify my AppleScript so as to not raise an exception. Maybe check for the existence of the front document before asking for its URL.
• Don't use the "All Exceptions" breakpoint.
• File a bug.
What do you think?
Thanks,
Jerry Krinock
[1] Call Stack at exception
#0 0x00007fff9234651c in __cxa_throw ()
#1 0x000000010c615d16 in Raise(long, long) ()
#2 0x000000010c63fbf4 in UASDecodeReply(TStackFrame_UASRemoteSend*, short, AEDesc*, unsigned char*) ()
#3 0x000000010c640095 in UASRemoteSend(unsigned char, unsigned char, unsigned char, unsigned char, unsigned char, unsigned char*) ()
#4 0x000000010c637f53 in UASRemoteGetData(TUASObjectAlias*, TUASApplication*, TUASClassIdentifier*, unsigned char*) ()
#5 0x000000010c64a8ec in UASGetDataNoCircularities(unsigned char, TUASClassIdentifier*) ()
#6 0x000000010c64a959 in UASGetData(unsigned char, TUASClassIdentifier*) ()
#7 0x000000010c6284ba in UASExecute1() ()
#8 0x000000010c62831a in UASExecute(unsigned char) ()
#9 0x000000010c5fe17f in ASExecute(unsigned int, unsigned int, int, unsigned int*) ()
#10 0x000000010c5fa33a in AppleScriptComponent ()
#11 0x000000010c61161b in AGenericCall::Delegate(ComponentInstanceRecord*) ()
#12 0x000000010c6115e5 in AGenericManager::HandleOSACall(ComponentParameters*) ()
#13 0x000000010c610c97 in GenericComponent ()
#14 0x00007fff92420adb in OSAExecute ()
#15 0x00007fff8e42d73f in -[NSAppleScript(NSPrivate) _executeWithMode:andReturnError:] ()
#16 0x00000001000b21f7 in -[ExtoreSafari prepareBrowserForExportWithInfo:error_p:] at /Users/jk/Documents/Programming/Projects/BkmkMgrs/ExtoreSafari.m:820
_______________________________________________
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