Hey hey!
I'm making an iphone based app and I have issues catching exceptions. So far, I've never had problem with try catches but here... well :D
Here is the code that doesn't catch any exception :
- (void)updateView:(NSTimer*)t {
NSMutableDictionary *requestResult = [[[NSMutableDictionary alloc] init] autorelease];
@try {
requestResult = [self.eqParam getParameters];
}
@catch (MMConnectionFailed * e) {
[self performSelectorOnMainThread:@selector(noConnection) withObject:@"Could not reach server." waitUntilDone:YES];
}
}
The lower side methods throw well exceptions in debug mode in case of an exception but when this method is concerned, nothing is caught.
Any clue?
UPDATE :
Finally, I found out where the problem was but I still don't know why the exception wasn't thrown on the lower lever. I changed the end of my getParameters
method. Here :
- (NSMutableDictionary *)getParameters {
@try {
// be careful with NSMutableDictionary. Has to be used with setters to be correctly affected
lastResponse = [MMSoapMethods getEquipmentParametersWithUserString:user equipmentId:equipmentId];
}
@catch (MMConnectionFailed * e) {
@throw e;
}
@finally {
if (self.lastResponse) {
return lastResponse;
}
else
return nil;
}
}
I just removed the @finally
surrounding tags and the exception was thrown. Strange, isn't it?