Better error handling loading resources

This commit is contained in:
Grahame Grieve 2023-03-30 08:30:47 +11:00
parent bb94efa873
commit 5e2330c6e2
1 changed files with 3 additions and 1 deletions

View File

@ -126,7 +126,9 @@ public abstract class ParserBase {
public Element parseSingle(InputStream stream) throws IOException, FHIRFormatError, DefinitionException, FHIRException {
List<NamedElement> res = parse(stream);
if (res.size() == 0) {
if (res == null) {
throw new FHIRException("Parsing FHIR content failed: "+errors.get(0).summary());
} else if (res.size() == 0) {
throw new FHIRException("Parsing FHIR content returned no elements in a context where one element is required");
}
if (res.size() != 1) {