Skip to content

Commit

Permalink
Merge pull request #3291 from ingef/feature/improve_log_message
Browse files Browse the repository at this point in the history
Improve log message during import
  • Loading branch information
thoniTUB authored Feb 8, 2024
2 parents 70dc817 + 422c6cc commit 92468c5
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public void assertMatch(Table table) {
StringJoiner errors = new StringJoiner("\n");

if (table.getColumns().length != getColumns().length) {
errors.add(String.format("Length=`%d` does not match table Length=`%d`", getColumns().length, table.getColumns().length));
errors.add(String.format("Import column count=`%d` does not match table column count=`%d`", getColumns().length, table.getColumns().length));
}

final Map<String, MajorTypeId> typesByName = Arrays.stream(getColumns())
Expand All @@ -70,7 +70,7 @@ public void assertMatch(Table table) {
final Column column = table.getColumns()[i];

if(!typesByName.containsKey(column.getName())){
errors.add(String.format("Column[%s] is missing in Import.", column.getName()));
errors.add(String.format("Column[%s] is missing.", column.getName()));
}
else if (!typesByName.get(column.getName()).equals(column.getType())) {
errors.add(String.format("Column[%s] Types do not match %s != %s"
Expand All @@ -80,8 +80,8 @@ else if (!typesByName.get(column.getName()).equals(column.getType())) {
}

if (errors.length() != 0) {
log.error(errors.toString());
throw new IllegalArgumentException(String.format("Headers[%s.%s] do not match Table[%s]. More Info in Logs.", getTable(), getName(), table.getId()));
log.error("Problems concerning Import `{}`:\n{}", name, errors);
throw new IllegalArgumentException(String.format("Headers[%s.%s] do not match Table[%s]. More info in logs.", getTable(), getName(), table.getId()));
}
}

Expand Down

0 comments on commit 92468c5

Please sign in to comment.