Skip to content
This repository has been archived by the owner on Jan 17, 2023. It is now read-only.

Commit

Permalink
Merge pull request #310 from cahn/experimental-try-catch-removal
Browse files Browse the repository at this point in the history
Try-catch in Objective-C should not be used to recover from exceptions
  • Loading branch information
Mattt Thompson committed Apr 24, 2012
2 parents 9adb586 + c0bdc5d commit b91e2eb
Showing 1 changed file with 3 additions and 12 deletions.
15 changes: 3 additions & 12 deletions AFNetworking/AFURLConnectionOperation.m
Expand Up @@ -128,18 +128,9 @@ @implementation AFURLConnectionOperation

+ (void)networkRequestThreadEntryPoint:(id)__unused object {
do {
NSAutoreleasePool *exceptionPool = [[NSAutoreleasePool alloc] init];
NSException *caughtException = nil;
@try {
NSAutoreleasePool *runLoopPool = [[NSAutoreleasePool alloc] init];
[[NSRunLoop currentRunLoop] run];
[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];
NSAutoreleasePool *runLoopPool = [[NSAutoreleasePool alloc] init];
[[NSRunLoop currentRunLoop] run];
[runLoopPool drain];
} while (YES);
}

Expand Down

0 comments on commit b91e2eb

Please sign in to comment.