mirror of https://github.com/apache/lucene.git
LUCENE-1646: when throwing ParseException from QueryParser, include root cause
git-svn-id: https://svn.apache.org/repos/asf/lucene/java/trunk@787805 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
87de0c9688
commit
434da77559
|
@ -174,13 +174,20 @@ public class QueryParser implements QueryParserConstants {
|
||||||
}
|
}
|
||||||
catch (ParseException tme) {
|
catch (ParseException tme) {
|
||||||
// rethrow to include the original query:
|
// rethrow to include the original query:
|
||||||
throw new ParseException("Cannot parse '" +query+ "': " + tme.getMessage());
|
// rethrow to include the original query:
|
||||||
|
ParseException e = new ParseException("Cannot parse '" +query+ "': " + tme.getMessage());
|
||||||
|
e.initCause(tme);
|
||||||
|
throw e;
|
||||||
}
|
}
|
||||||
catch (TokenMgrError tme) {
|
catch (TokenMgrError tme) {
|
||||||
throw new ParseException("Cannot parse '" +query+ "': " + tme.getMessage());
|
ParseException e = new ParseException("Cannot parse '" +query+ "': " + tme.getMessage());
|
||||||
|
e.initCause(tme);
|
||||||
|
throw e;
|
||||||
}
|
}
|
||||||
catch (BooleanQuery.TooManyClauses tmc) {
|
catch (BooleanQuery.TooManyClauses tmc) {
|
||||||
throw new ParseException("Cannot parse '" +query+ "': too many boolean clauses");
|
ParseException e = new ParseException("Cannot parse '" +query+ "': too many boolean clauses");
|
||||||
|
e.initCause(tmc);
|
||||||
|
throw e;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue