Giter VIP home page Giter VIP logo

Comments (4)

rpominov avatar rpominov commented on August 19, 2024

Hi, there is number of methods that can help you to do this. You already mentioned flatMap, and there is also valuesToErrors and withHandler.

About flatMap example not working without onValue handler, I can't reproduce that. This works fine:

Kefir.constant('hello').
flatMap(function(x) { return Kefir.constantError(new Error(x)); }).
onError(function(e) { console.error('GOT ERROR', e) });
// > GOT ERROR Error: hello {stack: (...), message: "hello"}

from kefir.

rpominov avatar rpominov commented on August 19, 2024

And to answer the question "the _active property only is true when there is a onValue handler?": No, all handlers (onValue, onError, onEnd, onAny) activate the observable.

from kefir.

rooftopsparrow avatar rooftopsparrow commented on August 19, 2024

The flatMap.onError does work for me. For some reason when I was testing it, but I fear I probably messed something up while figuring this out (most likely a copy-paste mess up 😞 ).

Thanks for the great effort and contribution to the community! 👍

from kefir.

rpominov avatar rpominov commented on August 19, 2024

Sorry, just noticed, I wrote errorsToValues, but it should be valuesToErrors of course. But I guess you've figured that out already :)

(fixed in the original comment)

from kefir.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.