Re: Exception not being caught
Re: Exception not being caught
- Subject: Re: Exception not being caught
- From: Rick Mann <email@hidden>
- Date: Mon, 21 Mar 2011 14:05:26 -0700
On Mar 21, 2011, at 2:03 PM, Greg Parker wrote:
> On Mar 20, 2011, at 9:11 PM, Rick Mann wrote:
>> On Mar 20, 2011, at 12:45 PM, email@hidden wrote:
>>> On 20 Mar 2011, at 19:17, Rick Mann wrote:
>>>> I have some code, called from a subclass of NSOperation, that throws an exception pretty reliably if I put a breakpoint elsewhere in the code (it is code that does an HTTP request, and it's getting a broken pipe, and raising an exception to report it; the breakpoint (in another thread) seems to trigger this behavior).
>>>>
>>>> My NSOperation subclass wraps the call to the network code in a @try/catch block. But when this exception is raised, the app terminates due to an uncaught exception.
>>
>> 2011-03-20 18:41:13.233 MissionClock[17979:7e03] *** Terminating app due to uncaught exception 'NSInvalidArchiveOperationException', reason: 'Network error domain:NSURLErrorDomain code:-1005'
>> *** Call stack at first throw:
>> (
>> 0 CoreFoundation 0x015be5a9 __exceptionPreprocess + 185
>> 1 libobjc.A.dylib 0x01712313 objc_exception_throw + 44
>> 2 CoreFoundation 0x01576ef8 +[NSException raise:format:arguments:] + 136
>> 3 CoreFoundation 0x01576e6a +[NSException raise:format:] + 58
>> 4 MissionClock 0x00010920 -[CWDistantHessianObject(Private) sendRequestWithPostData:] + 426
>> 5 MissionClock 0x000115ad -[CWDistantHessianObject forwardInvocation:] + 77
>> 6 CoreFoundation 0x0152fa04 ___forwarding___ + 1124
>> 7 CoreFoundation 0x0152f522 _CF_forwarding_prep_0 + 50
>> 8 MissionClock 0x0001aef8 -[GetMissionListOp main] + 722
>> 9 Foundation 0x00128b76 -[__NSOperationInternal start] + 747
>> 10 Foundation 0x001287ca ____startOperations_block_invoke_2 + 106
>> 11 libdispatch_sim.dylib 0x01bf1289 _dispatch_call_block_and_release + 16
>> 12 libdispatch_sim.dylib 0x01bf458a _dispatch_worker_thread2 + 252
>> 13 libSystem.B.dylib 0x92b46d41 _pthread_wqthread + 390
>> 14 libSystem.B.dylib 0x92b46b86 start_wqthread + 30
>> )
>
> You can't currently throw an exception across a forwarded call. When the exception unwinder hits the forwarding frame, it stops and the exception goes uncaught. You'll need to put your exception handler at a different level.
Thanks for the info, Greg! I hope I can find a place to put the handler.
--
Rick
_______________________________________________
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