Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ public class MappingMongoConverter extends AbstractMongoConverter
implements ApplicationContextAware, EnvironmentCapable {

private static final String INCOMPATIBLE_TYPES = "Cannot convert %1$s of type %2$s into an instance of %3$s; Implement a custom Converter<%2$s, %3$s> and register it with the CustomConversions; Parent object was: %4$s";
private static final String INCOMPATIBLE_MAP = "Expected map like structure but found %s";
private static final String INVALID_TYPE_TO_READ = "Expected to read Document %s into type %s but didn't find a PersistentEntity for the latter";

public static final TypeInformation<Bson> BSON = TypeInformation.of(Bson.class);
Expand Down Expand Up @@ -2392,9 +2393,8 @@ public <S extends Object> S convert(Object source, TypeInformation<? extends S>
if (BsonUtils.supportsBson(source)) {
return (S) mapConverter.convert(context, BsonUtils.asBson(source), typeHint);
}

throw new IllegalArgumentException(
String.format("Expected map like structure but found %s", source.getClass()));
throw new MappingException(
String.format(INCOMPATIBLE_MAP, source));
}

if (source instanceof DBRef dbRef) {
Expand Down