rxjs icon indicating copy to clipboard operation
rxjs copied to clipboard

replace UnobservableError "invalid object" with object type

Open abacaphiliac opened this issue 4 years ago • 3 comments

Description:

My application was crashing with the following generic error.

You provided an invalid object where a stream was expected. You can provide an Observable, Promise, Array, AsyncIterable, or Iterable.

Upon closer inspection, I discovered that the object was indeed an Observable. The underlying issue was that multiple versions of rxjs were installed in my application. Once I was able to see that the "invalid object" was an "Observable", I knew immediately to audit node_modules for this issue. I'm hopeful that providing additional information about this runtime error will help others.

Related issue (if exists):

None that I could find.

abacaphiliac avatar Dec 03 '20 21:12 abacaphiliac

I've been thinking about this, and we may want to start having error numbers and documentation links with more concise messages overall. We have to ship all of this code, after all.

Something like RX0001 - object unobservable https://rxjs.dev/errors#RX0001 or RX0002 - Foreign observable https://rxjs.dev/errors#RX0002 and so on, where we can provide detailed information about what that error means, why it's happening, and how to solve it.

benlesh avatar Feb 04 '21 19:02 benlesh

Core Team:

  • Not sure if this provides a ton more value than what we have.
  • People usually want to know where the returned thing was created or returned that didn't get converted to an observable.

There is an interesting proposal from 2014 by @stefanpenner brought to my attention by @ladyleet today: https://bugs.chromium.org/p/chromium/issues/detail?id=332624

Something like that might help get better context as to where something came from.

(BTW: Sorry @abacaphiliac for super late re-review)

benlesh avatar Mar 23 '22 20:03 benlesh

CORE TEAM: We can get this in v8 maybe. It doesn't save the world, but maybe it will help someone? 🤷‍♂️

benlesh avatar Feb 08 '23 21:02 benlesh