mirror of
https://github.com/hapifhir/org.hl7.fhir.core.git
synced 2025-03-02 09:29:13 +00:00
Better error handling loading resources
This commit is contained in:
parent
bb94efa873
commit
5e2330c6e2
@ -126,7 +126,9 @@ public abstract class ParserBase {
|
|||||||
|
|
||||||
public Element parseSingle(InputStream stream) throws IOException, FHIRFormatError, DefinitionException, FHIRException {
|
public Element parseSingle(InputStream stream) throws IOException, FHIRFormatError, DefinitionException, FHIRException {
|
||||||
List<NamedElement> res = parse(stream);
|
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");
|
throw new FHIRException("Parsing FHIR content returned no elements in a context where one element is required");
|
||||||
}
|
}
|
||||||
if (res.size() != 1) {
|
if (res.size() != 1) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user