Add better error reporting to RestApiParser if assertions are tripped
This commit is contained in:
parent
e2c8ff92ba
commit
34a3e8af35
|
@ -126,7 +126,7 @@ public class RestApiParser {
|
|||
}
|
||||
|
||||
parser.nextToken();
|
||||
assert parser.currentToken() == XContentParser.Token.END_OBJECT;
|
||||
assert parser.currentToken() == XContentParser.Token.END_OBJECT : "Expected [END_OBJECT] but was [" + parser.currentToken() +"]";
|
||||
parser.nextToken();
|
||||
|
||||
return restApi;
|
||||
|
|
|
@ -56,7 +56,7 @@ public class RestSpec {
|
|||
XContentParser parser = JsonXContent.jsonXContent.createParser(new FileInputStream(jsonFile));
|
||||
RestApi restApi = new RestApiParser().parse(parser);
|
||||
restSpec.addApi(restApi);
|
||||
} catch (IOException ex) {
|
||||
} catch (Throwable ex) {
|
||||
throw new IOException("Can't parse rest spec file: [" + jsonFile + "]", ex);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue