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

Client.connect: Handle unspecified error in response #12

Conversation

aknuds1
Copy link
Contributor

@aknuds1 aknuds1 commented Jul 3, 2019

I noticed when testing in libp2p/interop, that this library would sometimes fail in Client.connect due to an undefined ErrorResponse in the response. With this PR I try to handle this case gracefully. I observed that the error could have an error property instead, so I added tests both for when error is defined and when neither that not ErrorResponse is present.

I also added chai-as-promised as a dev dependency, in order to test async errors more cleanly (without boilerplate).

@aknuds1 aknuds1 force-pushed the bugfix/handle-unspecified-connect-failure branch 4 times, most recently from 7a34a01 to ace8830 Compare July 4, 2019 07:07
@vasco-santos
Copy link
Member

Thanks for the PR @aknuds1 .

Can you please rebase this with the new changes in master before I review it?

@aknuds1 aknuds1 force-pushed the bugfix/handle-unspecified-connect-failure branch 2 times, most recently from 3cad465 to 73c25d0 Compare July 9, 2019 10:56
@aknuds1 aknuds1 force-pushed the bugfix/handle-unspecified-connect-failure branch from 73c25d0 to 7be4616 Compare July 9, 2019 11:02
@aknuds1
Copy link
Contributor Author

aknuds1 commented Jul 9, 2019

@vasco-santos Done!

Copy link
Member

@vasco-santos vasco-santos left a comment

Choose a reason for hiding this comment

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

LGTM! Thanks for adding a fallback to the errorMessage

@vasco-santos vasco-santos merged commit 7db681b into libp2p:master Jul 9, 2019
@aknuds1 aknuds1 deleted the bugfix/handle-unspecified-connect-failure branch July 9, 2019 12:01
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