replace UnobservableError "invalid object" with object type - #5915
replace UnobservableError "invalid object" with object type#5915abacaphiliac wants to merge 2 commits into
Conversation
| }); | ||
| it('Should handle an Observable', () => { | ||
| const error = createInvalidObservableTypeError(from<string>('FooBar')); | ||
| expect(error.message).to.match(/^You provided type 'Observable' where a stream was expected./); |
There was a problem hiding this comment.
I understand what this is trying to do, but this error would make me want to scream if I saw it and didn't know what it meant.
"You provided type 'Observable' where a stream was expected. You can provide an Observable, Promise, Array, AsyncIterable, or Iterable."We probably need to do something where we actually link to some documentation about what could be going on. 🤔
Or at the very least maybe it needs to say something like "unsupported Observable" or.. something that makes RxJS look less like it's losing it's mind.
There was a problem hiding this comment.
IMO, it's worth checking the ctor name against 'Observable' and saying something like:
"You provided type 'Observable' (from another package) where a stream was expected. ..."
There was a problem hiding this comment.
thanks for the suggestions. i'll get it done. is there any documentation or are there any relevant issues that should be included in the error message?
|
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 |
|
Core Team:
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) |
|
CORE TEAM: We can get this in v8 maybe. It doesn't save the world, but maybe it will help someone? 🤷♂️ |
|
Hi @abacaphiliac — thank you for the time, care, and thoughtfulness you put into this pull request. I’m sorry we weren’t able to respond in a reasonable timeframe. Since the codebase and surrounding context have moved on and this hasn’t seen recent activity, I’m going to close it for now. That’s a reflection of our delayed triage, not a lack of appreciation for your contribution. If the change is still relevant, please feel welcome to open a fresh pull request against the current codebase. Thank you again for contributing to RxJS and for your patience. — Ben |
Description:
My application was crashing with the following generic error.
Upon closer inspection, I discovered that the object was indeed an
Observable. The underlying issue was that multiple versions ofrxjswere installed in my application. Once I was able to see that the "invalid object" was an "Observable", I knew immediately to auditnode_modulesfor 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.