Hi, I (as some of you know from my other questions :)) am building a cocoa-touch static library, and I have the code [NSException raise:@"This is the name of my exception" format:@"This is my format", nil]
scattered throughout my project as a shortcut to subclassing NSException
. This is coming back to bite me, as that I need to catch ONLY an exception that has a certain string in the name, and let others go by.
Now I know, that If I subclassed NSException
I could do this:
@try {
NSLog(@"This is some code that might raise an exception");
}
@catch (MyException *e){
NSLog(@"Yep, something went wrong....%@", e);
}
@finally {
NSLog(@"This is my cleanup code");
}
But is there an easier way of me doing this than refactoring all my code?