Add better error reporting to RestApiParser if assertions are tripped

This commit is contained in:
Simon Willnauer 2014-04-09 23:16:17 +02:00
parent e2c8ff92ba
commit 34a3e8af35
2 changed files with 2 additions and 2 deletions

View File

@ -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;

View File

@ -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);
}
}