I have the following code which uses node-postgres:
var client = new pg.Client(conString);
client.connect(function(err) {
if(err) {
throw new Error(console.error('could not connect to postgres '+ err));
}
});
client.query('select * from public.spatial_ref_sys', function(err, result){
console.log('ffdafda');
throw new Error('kokpokopko');
});
I would think when this code executes, 'ffdafda' would be printed to the screen and an error with message 'kokpokopko' would be thrown. I even stuck a in breakpoint which never breaks in the debugger. Since these things never occur, I am assuming the callback is never called.
Is there some sort of option I need in order to get the callback called? I am reading the documentation and I see nothing.
It is important to note client.query is being called. I have proved it by checking its return value.
Thank you very much!