-
-
Save rlemon/3fd38f54a70a07a04dde to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var Promise = require('bluebird'); | |
Promise.longStackTraces(); | |
var pg = Promise.promisifyAll(require('pg')); | |
var connString = '****************************************'; | |
module.exports.getSubscribers = function() { | |
return pg.connectAsync(connString).bind({}).then(function(client, done) { | |
this.done = done; | |
return Promise.promisifyAll(client).queryAsync('SELECT * FROM subscribers'); | |
}).then(function(res) { | |
this.done(); | |
return res; | |
}).finally(function() { | |
pg.end(); | |
}); | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Possibly unhandled TypeError: Object [object Object],function (err) { | |
at Object.<anonymous> (/modules/db.js:9:39) | |
From previous event: | |
at connectAsync (eval at makeNodePromisifiedEval (/node_modules/bluebird/js/main/promisify.js:198:12), <anonymous>:2:125) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment