handle unknown query types in db error log

This commit is contained in:
Mononaut 2023-11-14 06:13:06 +00:00
parent 29cbdf6cd5
commit 5c0a59d2f6
No known key found for this signature in database
GPG Key ID: A3F058E41374C04E

View File

@ -55,7 +55,7 @@ import { execSync } from 'child_process';
}).then(result => {
resolve(result);
}).catch(error => {
logger.debug(`database query "${query?.slice(0, 100)}" failed!`);
logger.debug(`database query "${query?.sql?.slice(0, 160) || (typeof(query) === 'string' || query instanceof String ? query?.slice(0, 160) : 'unknown query')}" failed!`);
reject(error);
}).finally(() => {
clearTimeout(timer);
@ -66,7 +66,7 @@ import { execSync } from 'child_process';
const pool = await this.getPool();
return pool.query(query, params);
} catch (e) {
logger.debug(`database query "${query?.slice(0, 100)}" failed!`);
logger.debug(`database query "${query?.sql?.slice(0, 160) || (typeof(query) === 'string' || query instanceof String ? query?.slice(0, 160) : 'unknown query')}" failed!`);
throw e;
}
}