I've created a simple rx operator that converts a stream of strings to a stream of jsons and it works fine. However, I would like to be able to raise a custom exception and I am not sure how to call the on_error
method of the subscription
The operator is called convertStringToJson
and a working sample can be found here: https://github.com/cipriancaba/rxcpp-examples/blob/master/src/SimpleOperators.cpp
function<observable<json>(observable<string>)> SimpleOperators::convertFromStringToJson() {
return [](observable<string> $str) {
return $str |
Rx::map([](const string s) {
return json::parse(s);
});
};
}