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

Tiny error propagation fix, no accompanying test :( #1

Merged
1 commit merged into from
Oct 31, 2010

Conversation

pshc
Copy link
Contributor

@pshc pshc commented Oct 31, 2010

Hey, I'm new to the whole fork/pull request thing. I'm more trying this out than considering this a SRS FEATURE that YOU MUST ACCEPT. Am I supposed to do this in a separate branch?

Anyway, for some reason I keep getting a broken pipe which was killing my connection. Three lines to the rescue.

@brianc
Copy link
Owner

brianc commented Oct 31, 2010

I like it! I think that's a nice idea. Much better to only have to handle the 'error' event at one level (Client or Connection), and not having to do this is a win:

var client = new Client();
client.connection.stream.on('error', function() { /*whatever*/ });

I would like to see some tests for this eventually...how about something like this?

//in test/unit/connection/startup-tests.js
test('stream error propagates to connection', function() {
  var stream = new MemoryStream();
  var con = new Connection({stream: stream});
  assert.raises(con, 'error', function(err) {
    assert.equal(err, "OMG!")
  });
  stream.emit('error', "OMG!");
});

That being said, I've not tested the error propagation from connection to client either I don't believe. I'll go ahead and merge your changes here in a minute.

@pshc
Copy link
Contributor Author

pshc commented Oct 31, 2010

Didn't realize it'd be so easy to test. Nice!

brianc pushed a commit that referenced this pull request Sep 2, 2013
brianc pushed a commit that referenced this pull request Feb 26, 2014
Algunenano pushed a commit to Algunenano/node-postgres that referenced this pull request May 8, 2018
Fail if pgsql returned row is bigger than limit
brianc added a commit that referenced this pull request Dec 20, 2019
Emit 'close' events when query completes
brianc added a commit that referenced this pull request Dec 27, 2019
Demonstrate that pg-pool exports Pool constructor
brianc pushed a commit that referenced this pull request Apr 28, 2020
Support usage of relative urls to set database on the default host
This pull request was closed.
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.

None yet

2 participants