mirror of
https://github.com/dbgate/dbgate
synced 2024-11-07 20:26:23 +00:00
oracle - reporting error line numbers
This commit is contained in:
parent
aad4df419c
commit
33552e30b7
@ -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',
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user