better failure message if a type parser is not found with dynamic tempaltes

This commit is contained in:
Shay Banon 2011-10-25 01:10:49 +02:00
parent e3a9f3beb7
commit 3f4eea469c
1 changed files with 6 additions and 1 deletions

View File

@ -207,7 +207,12 @@ public class RootObjectMapper extends ObjectMapper {
return null;
}
Mapper.TypeParser.ParserContext parserContext = context.docMapperParser().parserContext();
return parserContext.typeParser(dynamicTemplate.mappingType(dynamicType)).parse(name, dynamicTemplate.mappingForName(name, dynamicType), parserContext);
String mappingType = dynamicTemplate.mappingType(dynamicType);
Mapper.TypeParser typeParser = parserContext.typeParser(mappingType);
if (typeParser == null) {
throw new MapperParsingException("failed to find type parsed [" + mappingType + "] for [" + name + "]");
}
return typeParser.parse(name, dynamicTemplate.mappingForName(name, mappingType), parserContext);
}
public DynamicTemplate findTemplate(ContentPath path, String name, String dynamicType) {