garydgregory commented on code in PR #347:
URL: https://github.com/apache/commons-csv/pull/347#discussion_r1313274252
##########
src/main/java/org/apache/commons/csv/CSVParser.java:
##########
@@ -765,7 +765,13 @@ CSVRecord nextRecord() throws IOException {
final long startCharPosition = lexer.getCharacterPosition() +
this.characterOffset;
do {
this.reusableToken.reset();
- this.lexer.nextToken(this.reusableToken);
+ try {
+ this.lexer.nextToken(this.reusableToken);
+ } catch (IOException ioe) {
+ String errorMessage = "Exception during parsing at line: "
+ + this.lexer.getCurrentLineNumber() + ", position: " +
this.lexer.getCharacterPosition();
Review Comment:
Wait a sec, why is code in the parser instead of in the lexer? All this
catch does it extract information out of the lexer, so why not have exception
thrown by the lexer provide this information in the first place in a better
message?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]