+(void) throwIfTrueWithParam: (Boolean) param {
@try {
if (param) {
@throw [NSException
exceptionWithName:@"TestException"
reason:@"test exception"
userInfo:nil];;
}
}
@catch (NSException *exception) {
NSLog(@"%@", @"catch");
}
@finally {
NSLog(@"%@", @"finally");
}
}
[self throwIfTrueWithParam:true];
//printed: "catch" and "finally"
[self throwIfTrueWithParam:false];
//printed only "finally"