sql error line number - postgres

This commit is contained in:
Jan Prochazka 2022-09-25 19:50:31 +02:00
parent 1a7f06342f
commit 7781ad69cf

View File

@ -147,10 +147,14 @@ const drivers = driverBases.map(driverBase => ({
query.on('error', error => {
console.log('ERROR', error);
const { message, lineNumber, procName } = error;
const { message, position, procName } = error;
let line = null;
if (position) {
line = sql.substring(0, parseInt(position)).replace(/[^\n]/g, '').length;
}
options.info({
message,
line: lineNumber,
line,
procedure: procName,
time: new Date(),
severity: 'error',