void methodWithException(void) {
@try {
@throw [NSException
exceptionWithName:@"TestException"
reason:@"test exception"
userInfo:nil];
}
@catch (NSException *e) {
//частичная обработка, затем передача
//исключения дальше: голый @throw
//повторно возбуждает текущее
NSLog(@"partial processing");
@throw;
}
}
@try {
methodWithException();
}
@catch (NSException *e) {
NSLog(@"%@", e.reason);
//напечатано 'test exception'
}