improve error messages when rendering bundles that are documents that aren't properly formed

This commit is contained in:
Grahame Grieve 2020-12-03 12:54:03 +11:00
parent 532aba2485
commit 1372d58ad4
1 changed files with 1 additions and 1 deletions

View File

@ -63,7 +63,7 @@ public class BundleRenderer extends ResourceRenderer {
List<BaseWrapper> entries = b.children("entry");
if ("document".equals(b.get("type").primitiveValue())) {
if (entries.isEmpty() || (entries.get(0).has("resource") && "Composition".equals(entries.get(0).get("resource").fhirType())))
throw new FHIRException("Invalid document - first entry is not a Composition");
throw new FHIRException("Invalid document '"+b.getId()+"' - first entry is not a Composition ('"+entries.get(0).get("resource").fhirType()+"')");
return renderDocument(x, b, entries);
} else if ("collection".equals(b.get("type").primitiveValue()) && allEntriesAreHistoryProvenance(entries)) {
// nothing