Properly report error from unsuccessful source table fetching

Report terse error to user, verbose to log
This commit is contained in:
Sandro Santilli 2013-06-11 10:26:35 +02:00
parent 8d326dba2f
commit 70f535d13a

View File

@ -76,7 +76,8 @@ module.exports = function(){
}
if (res.statusCode != 200) {
var msg = res.body.error ? res.body.error : res.body;
callback(new Error('unexpected response status (' + res.statusCode + ') for sql query: ' + sql));
callback(new Error(msg));
console.log('unexpected response status (' + res.statusCode + ') for sql query: ' + sql + ': ' + msg);
return;
}
callback(null, body.rows);