Add better error reporting if a json spec can not be parsed
This commit is contained in:
parent
268c2e2563
commit
a66aead54a
|
@ -71,9 +71,13 @@ public class RestSpec {
|
||||||
RestSpec restSpec = new RestSpec();
|
RestSpec restSpec = new RestSpec();
|
||||||
for (String path : paths) {
|
for (String path : paths) {
|
||||||
for (File jsonFile : FileUtils.findJsonSpec(optionalPathPrefix, path)) {
|
for (File jsonFile : FileUtils.findJsonSpec(optionalPathPrefix, path)) {
|
||||||
XContentParser parser = JsonXContent.jsonXContent.createParser(new FileInputStream(jsonFile));
|
try {
|
||||||
RestApi restApi = new RestApiParser().parse(parser);
|
XContentParser parser = JsonXContent.jsonXContent.createParser(new FileInputStream(jsonFile));
|
||||||
restSpec.addApi(restApi);
|
RestApi restApi = new RestApiParser().parse(parser);
|
||||||
|
restSpec.addApi(restApi);
|
||||||
|
} catch (IOException ex) {
|
||||||
|
throw new IOException("Can't parse rest spec file: [" + jsonFile + "]", ex);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return restSpec;
|
return restSpec;
|
||||||
|
|
Loading…
Reference in New Issue