From 9ab35677255a6b628db8b955d467261d277a774a Mon Sep 17 00:00:00 2001 From: javi Date: Mon, 30 Jun 2014 19:55:47 +0200 Subject: [PATCH] fixed problem when a query raised a database error --- app/controllers/app.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/controllers/app.js b/app/controllers/app.js index 9a67e930..0c4dd466 100755 --- a/app/controllers/app.js +++ b/app/controllers/app.js @@ -381,7 +381,10 @@ function handleQuery(req, res) { //TODO: sanitize cdbuser console.log("SELECT CDB_QueryTables($quotesql$" + sql + "$quotesql$"); pg.query("SELECT CDB_QueryTables($quotesql$" + sql + "$quotesql$)", function (err, result) { - if (err) throw err; + if (err) { + self(err); + return; + } if ( result.rowCount === 1 ) { var raw_tables = result.rows[0].cdb_querytables; var tables = raw_tables.split(/^\{(.*)\}$/)[1].split(',');