Skip to content

Commit 3d6fc92

Browse files
fsteegcboehme
authored andcommitted
Improve error message when decoding CSV
Include expected and actual number of columns if they don't match
1 parent eb59ea9 commit 3d6fc92

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/main/java/org/culturegraph/mf/stream/converter/CsvDecoder.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,10 @@ public void process(final String string) {
6969
}
7070
getReceiver().endRecord();
7171
}else{
72-
throw new IllegalArgumentException("wrong number of columns in input line: " + string);
72+
throw new IllegalArgumentException(
73+
String.format(
74+
"wrong number of columns (expected %s, was %s) in input line: %s",
75+
header.length, parts.length, string));
7376
}
7477
}else{
7578
getReceiver().startRecord(String.valueOf(++count));

0 commit comments

Comments
 (0)