diff --git a/plugins/dbgate-plugin-oracle/src/backend/drivers.js b/plugins/dbgate-plugin-oracle/src/backend/drivers.js index 31a56657..8ff5cb24 100644 --- a/plugins/dbgate-plugin-oracle/src/backend/drivers.js +++ b/plugins/dbgate-plugin-oracle/src/backend/drivers.js @@ -154,10 +154,12 @@ const drivers = driverBases.map(driverBase => ({ }); query.on('error', error => { - console.log('ERROR', error); - const { message, lineNumber, procName } = error; + const { message, offset, procName } = error; + // get line number from string s of character at offset + const lineNumber = (sql.substring(0, offset).match(/\n/g) || []).length; options.info({ message, + offset, line: lineNumber, procedure: procName, time: new Date(), @@ -176,8 +178,11 @@ const drivers = driverBases.map(driverBase => ({ client.execute(sql, (err, res) => { if (err) { console.log('Error query', err, sql); + const lineNumber = (sql.substring(0, err.offset).match(/\n/g) || []).length; options.info({ message: err.message, + line: lineNumber, + offset: err.offset, time: new Date(), severity: 'error', });