[WIP] Fix subscriptions errors output #636
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hi!
I've been using GraphiQL with
subscriptions-transport-ws
package and discovered, that in case of subscriptions if there're some issues on server side, GraphiQL shows[object Object]
in output window, despite a message sent over WebSocket having correct stringified JSON.This happens because in case of an error (of errors), the error (or
error.stack
) just gets String casted, and if there's no.stack
, an error is effectively swallowed by showing[object Object]
instead. And the only way to debug this kind of server issues is to look at WebSocket messages directly, which isn't very convenient.There're 3 places in code where errors get String casted. Despite me actually tracing this
[object Object]
issue to only one place, I think that all of them could lead to such inconvenience.I propose that something should be done with this kind of situations (and with errors just being String casted). My PR isn't merge-ready, it's a matter of discussion.
So, what do you think?
This issue is indirectly mentioned in #17 and #88, and mentioned in apollographql/subscriptions-transport-ws#236 and apollographql/subscriptions-transport-ws#305.