Error event is never emitted
CamiloManrique opened this issue · comments
Camilo Manrique commented
If there is an error while processing the CSV, the error event is never emitted. Take this for example:
let inputStream = Fs.createReadStream(Path.join(__dirname, 'test-auto-parse.csv'), 'utf8');
let output = [];
inputStream
.pipe(new CsvReadableStream({
parseNumbers: true,
parseBooleans: true,
trim: true,
asObject: false,
skipHeader: true,
}))
.on('data', row => {
// Imagine an error is thrown here for any reason
})
.on('end', () => {
resolve(output);
})
.on('error', err => {
reject(err); // This is never executed
});
Instead the error is uncaught.