Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
4
Task/Exceptions/Objective-C/exceptions-1.m
Normal file
4
Task/Exceptions/Objective-C/exceptions-1.m
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
@interface MyException : NSException {
|
||||
//Put specific info in here
|
||||
}
|
||||
@end
|
||||
4
Task/Exceptions/Objective-C/exceptions-2.m
Normal file
4
Task/Exceptions/Objective-C/exceptions-2.m
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
- (void)foo {
|
||||
@throw [NSException exceptionWithName:@"TerribleException"
|
||||
reason:@"OMGWTFBBQ111!1" userInfo:nil];
|
||||
}
|
||||
16
Task/Exceptions/Objective-C/exceptions-3.m
Normal file
16
Task/Exceptions/Objective-C/exceptions-3.m
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
@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
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue