mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-18 00:56:02 +00:00
DBF reader - log errors
This commit is contained in:
@@ -4,6 +4,10 @@ const fs = require('fs');
|
|||||||
const stream = require('stream');
|
const stream = require('stream');
|
||||||
const { DBFFile } = require('dbffile');
|
const { DBFFile } = require('dbffile');
|
||||||
|
|
||||||
|
const { getLogger, extractErrorLogData } = global.DBGATE_PACKAGES['dbgate-tools'];
|
||||||
|
|
||||||
|
const logger = getLogger('dbfReader');
|
||||||
|
|
||||||
let dbgateApi;
|
let dbgateApi;
|
||||||
|
|
||||||
function getFieldType(field) {
|
function getFieldType(field) {
|
||||||
@@ -55,7 +59,7 @@ async function reader({ fileName, encoding = 'ISO-8859-1', includeDeletedRecords
|
|||||||
pass.write({
|
pass.write({
|
||||||
__isStreamHeader: true,
|
__isStreamHeader: true,
|
||||||
columns,
|
columns,
|
||||||
})
|
});
|
||||||
|
|
||||||
let readedRows = 0;
|
let readedRows = 0;
|
||||||
// Read each record and push it into the stream
|
// Read each record and push it into the stream
|
||||||
@@ -71,6 +75,7 @@ async function reader({ fileName, encoding = 'ISO-8859-1', includeDeletedRecords
|
|||||||
pass.end();
|
pass.end();
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
// If any error occurs, destroy the stream with the error
|
// If any error occurs, destroy the stream with the error
|
||||||
|
logger.error(extractErrorLogData(error), 'Error reading DBF file');
|
||||||
pass.end();
|
pass.end();
|
||||||
}
|
}
|
||||||
})();
|
})();
|
||||||
|
|||||||
Reference in New Issue
Block a user