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

End event doesn't fire on error #565

Closed
patriksimek opened this issue Apr 9, 2014 · 2 comments
Closed

End event doesn't fire on error #565

patriksimek opened this issue Apr 9, 2014 · 2 comments

Comments

@patriksimek
Copy link

node 0.11.12, node-postgres 3.0.1

pg.connect("postgres://...", function(err, client, done) {
    console.log('query');
    var q = client.query("select * from notexistingtable", []);
    q.on('error', function(err) {
        console.log('error');
    });
    q.on('end', function() {
        console.log('done');
    });
});

result in:

query
error

But there is no done reported in console.

Documentation says about End event: "Emitted by the query when all rows have been returned or when an error has been encountered. In either circumstance, the query's execution is finished and it is no longer interacting with the connection."

Work fine in node-postgres 2.8.5.

@brianc
Copy link
Owner

brianc commented Apr 9, 2014

Yeah this was a breaking change in version 3.0 of node-postgres

https://github.com/brianc/node-postgres/blob/master/NEWS.md#v300

Thanks for pointing out that bit in the documentation - will update it.

@patriksimek
Copy link
Author

Thanks, I missed that document.

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

No branches or pull requests

2 participants