-
Notifications
You must be signed in to change notification settings - Fork 352
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
fix(adapter-node-http): Fix unhandled rejection if connection fails #160
Conversation
Looks like CI passed for Node 8 and 10, but failed for 6 during package restore 🤷♂️ |
bb13473
to
be58a43
Compare
I've added a test that verifies the expected behavior in polly-proxy on the To repro with that project: To verify this fix: I'm not sure that adding |
FWIW I was able to successfully hack around the issue in |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for submitting these fixes @dustinsoftware! The changes look good but im skeptical on one part.
668b5b3
to
c1f9dac
Compare
An unhandled promise rejection was thrown if a socket could not be opened, which prevents handling the error gracefully in a consuming app.
c1f9dac
to
a789f9e
Compare
An unhandled promise rejection was thrown if a socket could not be opened,
which prevents handling the error gracefully in a consuming app.
First of all, thanks for building this library! I'm exposing a HTTP API on top of it here and it's working pretty well. However..
I'm running into a crash when polly can't connect to an API (port isn't open, for instance).
In my app, I'm tearing down the process if there are any unhandled promise rejections by using:
I had to fix promise rejection handling in a few places, but it works properly now. I've confirmed that this fix allows polly-proxy to return a graceful HTTP 500 from the express instance instead of crashing the app, but am unsure the best way to add a test for this type of bug.