这非常麻烦
RACSignal *originalSignal = ...;
RACSignal *mappedSignal = [[[[[originalSignal publish] autoconnect] materialize] map:^id(RACEvent *event) {
if(event.eventType == RACEventTypeError)
{
return [RACEvent eventWithError:[self errorForHelperError:event.error]];
}
return event;
}] dematerialize];
答案 0 :(得分:7)
-catch:
可让您更优雅地处理这个问题:
RACSignal *mappedSignal = [originalSignal catch:^(NSError *error) {
return [RACSignal error:[self errorForHelperError:error]];
}];