Skip to content

Commit 318ab1b

Browse files
authored
Merge pull request #422 from Keyang/errorMessageImprovements
Error message improvements
2 parents 4fcda10 + b601fcc commit 318ab1b

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

src/Converter.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ export class Converter extends Transform implements PromiseLike<any[]> {
4949
const rs = fs.createReadStream(filePath, options);
5050
rs.pipe(this);
5151
} else {
52-
this.emit('error', new Error("File does not exist. Check to make sure the file path to your csv is correct."));
52+
this.emit('error', new Error(`File does not exist at ${filePath}. Check to make sure the file path to your csv is correct.`));
5353
}
5454
});
5555
return this;

v1/core/Converter.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ Converter.prototype._transform = function (data, encoding, cb) {
105105
* From Keyang:
106106
* The code below is to check if a single utf8 char (which could be multiple bytes) being split.
107107
* If the char being split, the buffer from two chunk needs to be concat
108-
* check how utf8 being encoded to understand the code below.
108+
* check how utf8 being encoded to understand the code below.
109109
* If anyone has any better way to do this, please let me know.
110110
*/
111111
if ((data[idx] & 1<<7) !=0){
@@ -207,7 +207,7 @@ Converter.prototype._preProcessLines = function (lines, startIdx) {
207207
rtn.push(result);
208208
} else {
209209
rtn.push(lines[i]);
210-
this.emit("error", new Error("preProcessLine should return a string but got: " + JSON.stringify(result)));
210+
this.emit("error", new Error("preProcessLine should return a string but got: " + JSON.stringify(result) + "Type of this line is: " + typeof result));
211211
}
212212
}
213213
return rtn;
@@ -522,7 +522,7 @@ Converter.prototype.fromFile = function (filePath, cb, options) {
522522
rs = fs.createReadStream(filePath,options);
523523
rs.pipe(this);
524524
} else {
525-
this.emit('error', new Error("File does not exist. Check to make sure the file path to your csv is correct."));
525+
this.emit('error', new Error(`File does not exist at ${filePath}. Check to make sure the file path to your csv is correct.`));
526526
}
527527
}.bind(this));
528528
return this;

v2/Converter.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)