Skip to content

Commit

Permalink
Merge pull request #422 from Keyang/errorMessageImprovements
Browse files Browse the repository at this point in the history
Error message improvements
  • Loading branch information
dogabudak authored Apr 1, 2021
2 parents 4fcda10 + b601fcc commit 318ab1b
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/Converter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export class Converter extends Transform implements PromiseLike<any[]> {
const rs = fs.createReadStream(filePath, options);
rs.pipe(this);
} else {
this.emit('error', new Error("File does not exist. Check to make sure the file path to your csv is correct."));
this.emit('error', new Error(`File does not exist at ${filePath}. Check to make sure the file path to your csv is correct.`));
}
});
return this;
Expand Down
6 changes: 3 additions & 3 deletions v1/core/Converter.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ Converter.prototype._transform = function (data, encoding, cb) {
* From Keyang:
* The code below is to check if a single utf8 char (which could be multiple bytes) being split.
* If the char being split, the buffer from two chunk needs to be concat
* check how utf8 being encoded to understand the code below.
* check how utf8 being encoded to understand the code below.
* If anyone has any better way to do this, please let me know.
*/
if ((data[idx] & 1<<7) !=0){
Expand Down Expand Up @@ -207,7 +207,7 @@ Converter.prototype._preProcessLines = function (lines, startIdx) {
rtn.push(result);
} else {
rtn.push(lines[i]);
this.emit("error", new Error("preProcessLine should return a string but got: " + JSON.stringify(result)));
this.emit("error", new Error("preProcessLine should return a string but got: " + JSON.stringify(result) + "Type of this line is: " + typeof result));
}
}
return rtn;
Expand Down Expand Up @@ -522,7 +522,7 @@ Converter.prototype.fromFile = function (filePath, cb, options) {
rs = fs.createReadStream(filePath,options);
rs.pipe(this);
} else {
this.emit('error', new Error("File does not exist. Check to make sure the file path to your csv is correct."));
this.emit('error', new Error(`File does not exist at ${filePath}. Check to make sure the file path to your csv is correct.`));
}
}.bind(this));
return this;
Expand Down
4 changes: 2 additions & 2 deletions v2/Converter.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 318ab1b

Please sign in to comment.