improve error message when parsing json that is not a resource

This commit is contained in:
Grahame Grieve 2019-10-31 21:50:54 +11:00
parent cc496623a6
commit 55c379dab8
5 changed files with 15 additions and 0 deletions

View File

@ -11100,6 +11100,9 @@ public class JsonParser extends JsonParserBase {
@Override
protected Resource parseResource(JsonObject json) throws IOException, FHIRFormatError {
if (!json.has("resourceType")) {
throw new FHIRFormatError("Unable to find resource type - maybe not a FHIR resource?");
}
String t = json.get("resourceType").getAsString();
if (Utilities.noString(t))
throw new FHIRFormatError("Unable to find resource type - maybe not a FHIR resource?");

View File

@ -15542,6 +15542,9 @@ public class JsonParser extends JsonParserBase {
@Override
protected Resource parseResource(JsonObject json) throws IOException, FHIRFormatError {
if (!json.has("resourceType")) {
throw new FHIRFormatError("Unable to find resource type - maybe not a FHIR resource?");
}
String t = json.get("resourceType").getAsString();
if (Utilities.noString(t))
throw new FHIRFormatError("Unable to find resource type - maybe not a FHIR resource?");

View File

@ -19539,6 +19539,9 @@ public class JsonParser extends JsonParserBase {
@Override
protected Resource parseResource(JsonObject json) throws IOException, FHIRFormatError {
if (!json.has("resourceType")) {
throw new FHIRFormatError("Unable to find resource type - maybe not a FHIR resource?");
}
String t = json.get("resourceType").getAsString();
if (Utilities.noString(t))
throw new FHIRFormatError("Unable to find resource type - maybe not a FHIR resource?");

View File

@ -27405,6 +27405,9 @@ public class JsonParser extends JsonParserBase {
@Override
protected Resource parseResource(JsonObject json) throws IOException, FHIRFormatError {
if (!json.has("resourceType")) {
throw new FHIRFormatError("Unable to find resource type - maybe not a FHIR resource?");
}
String t = json.get("resourceType").getAsString();
if (Utilities.noString(t))
throw new FHIRFormatError("Unable to find resource type - maybe not a FHIR resource?");

View File

@ -28161,6 +28161,9 @@ public class JsonParser extends JsonParserBase {
@Override
protected Resource parseResource(JsonObject json) throws IOException, FHIRFormatError {
if (!json.has("resourceType")) {
throw new FHIRFormatError("Unable to find resource type - maybe not a FHIR resource?");
}
String t = json.get("resourceType").getAsString();
if (Utilities.noString(t))
throw new FHIRFormatError("Unable to find resource type - maybe not a FHIR resource?");