GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |||||||||
GeezerVison is showing github.com — Catch errors client throws in pool by zlotnika · Pull Request #2569 · brianc/node-postgres Conversation
|
|
I found the same is true for when failing to connect to the server, there's no way to catch the error. It simply crashes the app. I suppose this would resolve that as well. Would be great to see this merged 😄 |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
I apprecaite the contribution here. You're right, throwing errors on a method that accepts a callback or returns a promise is not a nice pattern. I will be happy to merge this if you write test coverage for the behavior. No tests, no merge for the most part as w/o tests its impossible for me to maintain backwards compatibility and prevent regressions long term. If you don't have time to write a test, I understand. In that case I'll try to come back & write test(s) for this & get it merged as soon as I can! |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
IMHO this is a crucial point for an application to run in production. Error management is really a must, not just a nice to have. Tryed to see if i can write a test, but had so many already existing tests failing that gave up. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
|
My exact problem being almost the same as @bryanph but also for DB server being shut down or having failures, i finally ended with this simple solution pool.on('connect', client => { client.on('error', (err)=> { pool.emit('error', err, client); }); }); Then handle the error from |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
I've tried writing a test, but I can't seem to get testing working on my machine. It looks like there's a lot of stuff set up for this, but no clear documentation. Could anyone either 1. write a test for me or 2. add something on running tests to the Readme or 3. tell me where else to find info on it? |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
This test _should be_ right
|
Alright. I've added a test that should work right. My environment is a bit different, so hopefully it'll run correctly on travis etc. Let me know if it works or whatever. Feel free to suggest fixes for it! |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
@brianc Is this PR still being considered? Have a problem similar to #2439 and was hoping to get something here in the upstream rather than fix elsewhere. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Hey @brianc is there any chance of some feedback on this PR? We've been suffering this issue using node-postgres with big aws aurora clusters where I work. We keep getting paged about it since we're getting containers dying in production every 15 mins or so. Is there any reason not to merge this PR? If you need better test coverage then I'm happy to help @zlotnika out there. Just hoping to be able to avoid having to fork this repo and publish a patched version of it since it's overhead I'd much rather do without. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
yes i am sorry - you're absolutely right this should be merged, and I will do that now & get a new release out tomorrow. There's some epic storm in Austin right now so...my power is going in and out but i'll get ya patched up tomorrow along w/ a salvo of other fixes. Sorry for the delay! |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
#2569 introduced a bug in the test. The test never passed but because travis-ci lovingly broke the integration we had a long time ago the tests weren't run in CI until I merged. So, this fixes the tests & does a better job cleaning up the query in an errored state.
* Fix error handling test #2569 introduced a bug in the test. The test never passed but because travis-ci lovingly broke the integration we had a long time ago the tests weren't run in CI until I merged. So, this fixes the tests & does a better job cleaning up the query in an errored state. * Update sponsors
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.