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