Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modify error handling #1

Closed
wants to merge 7 commits into from
Closed

Modify error handling #1

wants to merge 7 commits into from

Conversation

joeyates
Copy link
Contributor

This commit adds two callbacks, onError and onEvent to improve observability.

Attempts are made to recover from more error conditions, to avoid zombie connections that never reach 'connected' state.

@joeyates joeyates closed this Dec 14, 2021
} catch (e) {
if (e instanceof Response400Error || e instanceof InvalidResponseError) {
throw e;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the response is a 4xx, it means that the requested GraphQL query has some errors, and reconnecting won't help solve the situation. The same kinda applies to InvalidResponseError.. if the server is returning something that's not JSON it probably isn't something that can be solved by retrying. For the latter, maybe we can discuss about it :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've amended the change to only throw on 404s.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I closed this PR in favour of #2. Let's continue the review there

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants