Skip to content

Commit

Permalink
Simplify creation of exception messages
Browse files Browse the repository at this point in the history
  • Loading branch information
oschwald committed Dec 9, 2022
1 parent c1930c8 commit eeb22f5
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/main/java/com/maxmind/db/Decoder.java
Original file line number Diff line number Diff line change
Expand Up @@ -448,7 +448,7 @@ private <T> Object decodeMapIntoObject(int size, Class<T> cls)
+ " Java Type: " +parameterTypes[index].getCanonicalName());
}
}
throw new DeserializationException("Error creating object of type: " + cls.getSimpleName() + " - " + sbErrors.toString(), e);
throw new DeserializationException("Error creating object of type: " + cls.getSimpleName() + " - " + sbErrors, e);
}
}

Expand Down
3 changes: 1 addition & 2 deletions src/main/java/com/maxmind/db/Reader.java
Original file line number Diff line number Diff line change
Expand Up @@ -184,8 +184,7 @@ record = this.readNode(buffer, record, bit);
try {
dataRecord = this.resolveDataPointer(buffer, record, cls);
} catch (DeserializationException exception) {
String msgCause = Optional.ofNullable(exception).map(Exception::getMessage).orElse("");
throw new DeserializationException("Error getting record for IP " + ipAddress.toString() + " - " + msgCause, exception);
throw new DeserializationException("Error getting record for IP " + ipAddress + " - " + exception.getMessage(), exception);
}
}
return new DatabaseRecord<>(dataRecord, ipAddress, pl);
Expand Down

0 comments on commit eeb22f5

Please sign in to comment.