From 6d2e843f50abf413bd09ffdeab497349badfca0f Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Tue, 12 May 2020 03:43:24 -0400 Subject: [PATCH] Fix "params.join is not a function" in DB.queryAsync() error logging If a query failed and `params` wasn't an array, the "params.join is not a function" would be thrown rather than a proper error. --- chrome/content/zotero/xpcom/db.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/chrome/content/zotero/xpcom/db.js b/chrome/content/zotero/xpcom/db.js index e32aa46e86..cb92a8f69a 100644 --- a/chrome/content/zotero/xpcom/db.js +++ b/chrome/content/zotero/xpcom/db.js @@ -662,7 +662,13 @@ Zotero.DBConnection.prototype.queryAsync = Zotero.Promise.coroutine(function* (s var eStr = e + ""; eStr = eStr.indexOf("Error: ") == 0 ? eStr.substr(7): e; throw new Error(eStr + ' [QUERY: ' + sql + '] ' - + (params ? '[PARAMS: ' + params.join(', ') + '] ' : '') + + (params + ? '[PARAMS: ' + + (Array.isArray(params) + ? params.map(x => JSON.stringify(x)).join(', ') + : JSON.stringify(params) + ) + '] ' + : '') + '[ERROR: ' + e.errors[0].message + ']'); } else {