Merge pull request #310 from cahn/experimental-try-catch-removal

Try-catch in Objective-C should not be used to recover from exceptions
This commit is contained in:
Mattt Thompson 2012-04-23 20:20:41 -07:00
commit b91e2eb87f

View file

@ -128,18 +128,9 @@ static inline BOOL AFStateTransitionIsValid(AFOperationState fromState, AFOperat
+ (void)networkRequestThreadEntryPoint:(id)__unused object { + (void)networkRequestThreadEntryPoint:(id)__unused object {
do { do {
NSAutoreleasePool *exceptionPool = [[NSAutoreleasePool alloc] init];
NSException *caughtException = nil;
@try {
NSAutoreleasePool *runLoopPool = [[NSAutoreleasePool alloc] init]; NSAutoreleasePool *runLoopPool = [[NSAutoreleasePool alloc] init];
[[NSRunLoop currentRunLoop] run]; [[NSRunLoop currentRunLoop] run];
[runLoopPool drain]; [runLoopPool drain];
}
@catch(NSException *e) { caughtException = e; }
if(caughtException) {
NSLog(NSLocalizedString(@"Unhandled exception on %@ networking thread: %@, userInfo: %@", nil), NSStringFromClass([self class]), caughtException, [caughtException userInfo]);
}
[exceptionPool drain];
} while (YES); } while (YES);
} }