Skip to content

Commit a66aead

Browse files
committed
Add better error reporting if a json spec can not be parsed
1 parent 268c2e2 commit a66aead

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/test/java/org/elasticsearch/test/rest/spec/RestSpec.java

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,13 @@ public static RestSpec parseFrom(String optionalPathPrefix, String... paths) thr
7171
RestSpec restSpec = new RestSpec();
7272
for (String path : paths) {
7373
for (File jsonFile : FileUtils.findJsonSpec(optionalPathPrefix, path)) {
74-
XContentParser parser = JsonXContent.jsonXContent.createParser(new FileInputStream(jsonFile));
75-
RestApi restApi = new RestApiParser().parse(parser);
76-
restSpec.addApi(restApi);
74+
try {
75+
XContentParser parser = JsonXContent.jsonXContent.createParser(new FileInputStream(jsonFile));
76+
RestApi restApi = new RestApiParser().parse(parser);
77+
restSpec.addApi(restApi);
78+
} catch (IOException ex) {
79+
throw new IOException("Can't parse rest spec file: [" + jsonFile + "]", ex);
80+
}
7781
}
7882
}
7983
return restSpec;

0 commit comments

Comments
 (0)