Is there a way for a RACSignal to keep receiving `next`s after an error?

489 views Asked by At

I'm trying to listen for both location updates and errors (through CLLocationManagerDelegate), and support the ability to track errors but filter them out of the final signal and keep it alive.

When I subscribe to the location signal (via ReactiveCocoaPlayground's -[LocationManager currentLocationSignal]), any errors received will end the signal.

I've tried -catch: and -catchTo: but those just catch one error and then end the signal.

I've tried returning a brand new instance of that signal inside -catch:, but then the error on THAT signal is uncaught (which causes a crash in a RAC() binding later on).

I've tried a recursive approach to that catch as well, which caused a stack overflow (maybe I just made a mistake though).

Is there a way to receive nexts after errors occur?

1

There are 1 answers

0
jscs On BEST ANSWER

I believe you're looking for -[RACSignal retry]:

/// Resubscribes to the receiving signal if an error occurs.
- (RACSignal *)retry;