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();
|
||||
for (String path : paths) {
|
||||
for (File jsonFile : FileUtils.findJsonSpec(optionalPathPrefix, path)) {
|
||||
try {
|
||||
XContentParser parser = JsonXContent.jsonXContent.createParser(new FileInputStream(jsonFile));
|
||||
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;
|
||||
|
|
Loading…
Reference in New Issue