Skip to content

Commit

Permalink
[SHIBUI-701]
Browse files Browse the repository at this point in the history
Clarified a couple error states.
  • Loading branch information
Bill Smith committed Nov 12, 2018
1 parent 98f1d5a commit 5a6f533
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,10 @@ public static List<String> getResolverTypes() {

public static SchemaType getSchemaType(String jsonType) {
List<SchemaType> schemaTypes = Stream.of(SchemaType.values()).filter(it -> it.getJsonType().equals(jsonType)).collect(Collectors.toList());
if (schemaTypes.size() != 1) {
throw new RuntimeException("Found two schema types for jsonType (" + jsonType + ")! How did this even happen?");
if (schemaTypes.size() > 1) {
throw new RuntimeException("Found multiple schema types for jsonType (" + jsonType + ")!");
} else if (schemaTypes.size() == 0) {
throw new RuntimeException("Found no schema types for jsonType (" + jsonType + ")! Verify that the code supports all schema types.");
} else {
return schemaTypes.get(0);
}
Expand Down

0 comments on commit 5a6f533

Please sign in to comment.