Throw errors instead of strings for DB errors

This commit is contained in:
Dan Stillman 2013-04-05 01:19:41 -04:00
parent 49da992285
commit 24184b6dc1

View file

@ -177,7 +177,7 @@ Zotero.DBConnection.prototype.query = function (sql,params) {
var dberr = (db.lastErrorString!='not an error')
? ' [ERROR: ' + db.lastErrorString + ']' : '';
throw(e + ' [QUERY: ' + sql + ']' + dberr);
throw new Error(e + ' [QUERY: ' + sql + ']' + dberr);
}
}
@ -256,7 +256,7 @@ Zotero.DBConnection.prototype.getStatement = function (sql, params, checkParams)
catch (e) {
var dberr = (db.lastErrorString!='not an error')
? ' [ERROR: ' + db.lastErrorString + ']' : '';
throw(e + ' [QUERY: ' + sql + ']' + dberr);
throw new Error(e + ' [QUERY: ' + sql + ']' + dberr);
}
var numParams = statement.parameterCount;