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.
This commit is contained in:
parent
0199428c57
commit
6d2e843f50
1 changed files with 7 additions and 1 deletions
|
@ -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 {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue