Better error message for bad regular expressions in GEL.
git-svn-id: http://google-refine.googlecode.com/svn/trunk@388 7d457c2a-affb-35e4-300a-418c747d4874
This commit is contained in:
parent
f402db10af
commit
93d6f9fc54
@ -140,8 +140,13 @@ public class Parser {
|
||||
} else if (_token.type == TokenType.Regex) {
|
||||
RegexToken t = (RegexToken) _token;
|
||||
|
||||
eval = new LiteralExpr(Pattern.compile(_token.text, t.caseInsensitive ? Pattern.CASE_INSENSITIVE : 0));
|
||||
next(false);
|
||||
try {
|
||||
Pattern pattern = Pattern.compile(_token.text, t.caseInsensitive ? Pattern.CASE_INSENSITIVE : 0);
|
||||
eval = new LiteralExpr(pattern);
|
||||
next(false);
|
||||
} catch (Exception e) {
|
||||
throw makeException("Bad regular expression (" + e.getMessage() + ")");
|
||||
}
|
||||
} else if (_token.type == TokenType.Number) {
|
||||
eval = new LiteralExpr(((NumberToken)_token).value);
|
||||
next(false);
|
||||
|
Loading…
Reference in New Issue
Block a user