From df08062ffb409a9f51d75477064ff47e5897b9dd Mon Sep 17 00:00:00 2001 From: Onja Date: Tue, 10 Oct 2023 17:24:15 +0300 Subject: [PATCH] Refactor column validation in File class to emit parse error event when columns are invalid --- src/models/file.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/models/file.js b/src/models/file.js index e54d11a..69bb411 100644 --- a/src/models/file.js +++ b/src/models/file.js @@ -124,8 +124,9 @@ class File { const stream = new PassThrough(); // check if columns is valid - if (!columns || columns.length) { + if (!columns || !columns.length) { // return Promise.reject(new Error('Invalid columns')); + emitter.emit('parse.error', { url: this.url, filepath: this.filepath, error: 'Invalid columns' }); return false; }