{"action":"created","issue":{"url":"https://api.github.com/repos/brianc/node-postgres/issues/746","labels_url":"https://api.github.com/repos/brianc/node-postgres/issues/746/labels{/name}","comments_url":"https://api.github.com/repos/brianc/node-postgres/issues/746/comments","events_url":"https://api.github.com/repos/brianc/node-postgres/issues/746/events","html_url":"https://github.com/brianc/node-postgres/issues/746","id":60727193,"number":746,"title":"Unhandled 'error' event thrown when the connection password doesn't match","user":{"login":"david-rouchet","id":9808806,"avatar_url":"https://avatars.githubusercontent.com/u/9808806?v=3","gravatar_id":"","url":"https://api.github.com/users/david-rouchet","html_url":"https://github.com/david-rouchet","followers_url":"https://api.github.com/users/david-rouchet/followers","following_url":"https://api.github.com/users/david-rouchet/following{/other_user}","gists_url":"https://api.github.com/users/david-rouchet/gists{/gist_id}","starred_url":"https://api.github.com/users/david-rouchet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/david-rouchet/subscriptions","organizations_url":"https://api.github.com/users/david-rouchet/orgs","repos_url":"https://api.github.com/users/david-rouchet/repos","events_url":"https://api.github.com/users/david-rouchet/events{/privacy}","received_events_url":"https://api.github.com/users/david-rouchet/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":28,"created_at":"2015-03-11T20:48:44Z","updated_at":"2015-06-08T16:19:06Z","closed_at":null,"body":"When I connect to an existing database with the connect username but the wrong password, I got an unhandled exception using the following code. The parameter err is set, but the exception is still thrown.\r\n\r\n````\r\npg.connect(dbURL, function(err, client, done) {\r\n  if(err) {\r\n    return console.error('error fetching client from pool', err);\r\n  }\r\n  client.query('SELECT $1::int AS number', ['1'], function(err, result) {\r\n    //call `done()` to release the client back to the pool\r\n    done();\r\n\r\n    if(err) {\r\n      return console.error('error running query', err);\r\n    }\r\n    console.log(result.rows[0].number);\r\n    //output: 1\r\n    client.end();\r\n  });\r\n});\r\n````\r\n"},"comment":{"url":"https://api.github.com/repos/brianc/node-postgres/issues/comments/110061081","html_url":"https://github.com/brianc/node-postgres/issues/746#issuecomment-110061081","issue_url":"https://api.github.com/repos/brianc/node-postgres/issues/746","id":110061081,"user":{"login":"vitaly-t","id":5108906,"avatar_url":"https://avatars.githubusercontent.com/u/5108906?v=3","gravatar_id":"","url":"https://api.github.com/users/vitaly-t","html_url":"https://github.com/vitaly-t","followers_url":"https://api.github.com/users/vitaly-t/followers","following_url":"https://api.github.com/users/vitaly-t/following{/other_user}","gists_url":"https://api.github.com/users/vitaly-t/gists{/gist_id}","starred_url":"https://api.github.com/users/vitaly-t/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vitaly-t/subscriptions","organizations_url":"https://api.github.com/users/vitaly-t/orgs","repos_url":"https://api.github.com/users/vitaly-t/repos","events_url":"https://api.github.com/users/vitaly-t/events{/privacy}","received_events_url":"https://api.github.com/users/vitaly-t/received_events","type":"User","site_admin":false},"created_at":"2015-06-08T16:19:06Z","updated_at":"2015-06-08T16:19:06Z","body":"@brianc you will end up in a situation where invalid server or database name are handled completely different from how invalid connection/user/password are handled. This shouldn't be the case."}}