ReactiveCocoa has a construct exactly for this situation called tryMap:
. Check it out:
[signal tryMap:^id(NSDictionary *dictionary, NSError **errorPtr) {
return [MTLJSONAdapter modelOfClass:SAMWebServiceResponse.class
fromJSONDictionary:dictionary
error:errorPtr];
}]
This assumes that modelOfClass:fromJSONDictionary:error:
will return nil
when an error occurs -- which is pretty standard -- but it's worth checking the docs on that just in case. The code as you've written it now will just return that error signal, which is a completely legitimate thing to do (signals of signals are the best part of RAC), but not what you want here.