add the original query to the parse exception message for easier debugging

git-svn-id: https://svn.apache.org/repos/asf/lucene/java/trunk@424708 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Daniel Naber 2006-07-23 11:08:36 +00:00
parent f72c1e579f
commit 53888844c0
2 changed files with 12 additions and 4 deletions

View File

@ -121,11 +121,15 @@ public class QueryParser implements QueryParserConstants {
try { try {
return Query(field); return Query(field);
} }
catch (ParseException tme) {
// rethrow to include the original query:
throw new ParseException("Cannot parse '" +query+ "': " + tme.getMessage());
}
catch (TokenMgrError tme) { catch (TokenMgrError tme) {
throw new ParseException(tme.getMessage()); throw new ParseException("Cannot parse '" +query+ "': " + tme.getMessage());
} }
catch (BooleanQuery.TooManyClauses tmc) { catch (BooleanQuery.TooManyClauses tmc) {
throw new ParseException("Too many boolean clauses"); throw new ParseException("Cannot parse '" +query+ "': too many boolean clauses");
} }
} }

View File

@ -144,11 +144,15 @@ public class QueryParser {
try { try {
return Query(field); return Query(field);
} }
catch (ParseException tme) {
// rethrow to include the original query:
throw new ParseException("Cannot parse '" +query+ "': " + tme.getMessage());
}
catch (TokenMgrError tme) { catch (TokenMgrError tme) {
throw new ParseException(tme.getMessage()); throw new ParseException("Cannot parse '" +query+ "': " + tme.getMessage());
} }
catch (BooleanQuery.TooManyClauses tmc) { catch (BooleanQuery.TooManyClauses tmc) {
throw new ParseException("Too many boolean clauses"); throw new ParseException("Cannot parse '" +query+ "': too many boolean clauses");
} }
} }