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:
commit
b91e2eb87f
1 changed files with 3 additions and 12 deletions
|
|
@ -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];
|
NSAutoreleasePool *runLoopPool = [[NSAutoreleasePool alloc] init];
|
||||||
NSException *caughtException = nil;
|
[[NSRunLoop currentRunLoop] run];
|
||||||
@try {
|
[runLoopPool drain];
|
||||||
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];
|
|
||||||
} while (YES);
|
} while (YES);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue