RosettaCodeData/Task/Exceptions/Objective-C/exceptions-3.m
Ingy döt Net d066446780 langs a-z
2013-04-10 22:43:41 -07:00

16 lines
374 B
Objective-C

@try {
[self foo];
}
@catch (MyException *exc) {
//Catch only your specified type of exception
}
@catch (NSException *exc) {
//Catch any NSException or subclass
NSLog(@"caught exception named %@, with reason: %@", [exc name], [exc reason]);
}
@catch (id exc) {
//Catch any kind of object
}
@finally {
//This code is always executed after exiting the try block
}