Git Product home page Git Product logo

Comments (4)

akarnokd avatar akarnokd commented on July 19, 2024 1

If you implement Observables like this, you have to follow the protocol, i.e., call onSubscribe with a Subscription before calling onNext.

However, this is an advanced use case and not recommended in most cases. You haven't shown what readItemPublisher does but you could probably get by with simply using Observable.create.

from rxjava.

akarnokd avatar akarnokd commented on July 19, 2024

It can only happen if onSubscribe was not called, which is a protocol violation.

How are you using the LambdaObserver?

from rxjava.

eciuca avatar eciuca commented on July 19, 2024

@akarnokd This is how I am using it. I am not touching any internal classes, I got to it by debugging.

Screenshot 2024-06-11 at 15 16 57
Screenshot 2024-06-11 at 15 17 27

And whenever an error is thrown from any subscriber created with a lambda (I guess this is why a LambdaObservable is created) I get a NPE instead of the actual error itself.

So the general case should be I have an observable. I subscribe to it and in the onNext handler an error is thrown, instead of getting the error on the onError channel it blows up in the try-catch with NPE. Do you still think I am using it wrong because I don't see how.

EDIT: I saw your answer here after this post: #7721 (comment)
EDIT 2: I am continuing the discussion on the issue

from rxjava.

eciuca avatar eciuca commented on July 19, 2024

Thank you very much! Using Observable.create instead of fromPublisher really does the trick (in my head I needed a Publisher to push values so I went for it instead of Observable.create which receives an ObservableOnSubscribe as parameter which is what I actually need anyway probably)

from rxjava.

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.