ReactiveCocoa/ReactiveCocoa — pull request #855 by lawrencelomax (2013-10-09 00:46:07+00:00)
Title: Mapping values to errors / inverse of catchTo:

I'm keen to keep my code as declarative as possible when using RAC. When interfacing with declarative methods, parsers typically return nil when the parser fails, the signal should error as a result.

```objective-c
[signal passWhen:^(id value) {
return [AParser parserThatReturnsNilOnFailure:value];
} sendError:^(id value) {
return [NSError error];
}];
```

The solution may read a little longer than the implementation itself, but I believe it is more obvious than the implementation. I also wanted to avoid conditionalising the sending of errors to if the map block returns ```NSError```, this would break in the case of a Signal of ```NSError```s.

A few things:
1) I don't like the name
2) If this is not a common use-case then it just increases the mental overhead of the API, while not adding much
3) Perhaps there needs to be a better way of returning an error from the ```passWhen:``` block. Loads of APIs as this take an ```NSError **``` so the error can be returned at the time the ```passWhen:``` block is called.
4) ```switchToLatest``` is implemented with multicasting, which must have some overhead when compared to sticking all the logic in a custom ```createSignal```.