From 21741ad09eb0486f4737f28c71a5cecefbf87f27 Mon Sep 17 00:00:00 2001 From: Owen Stephens Date: Tue, 28 Nov 2017 16:22:17 +0000 Subject: [PATCH] Pass user friendly error message to UI on invalid regular expression --- .../com/google/refine/browsing/facets/TextSearchFacet.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/main/src/com/google/refine/browsing/facets/TextSearchFacet.java b/main/src/com/google/refine/browsing/facets/TextSearchFacet.java index 03c6c1cf9..e8270d4fc 100644 --- a/main/src/com/google/refine/browsing/facets/TextSearchFacet.java +++ b/main/src/com/google/refine/browsing/facets/TextSearchFacet.java @@ -50,6 +50,7 @@ import com.google.refine.expr.Evaluable; import com.google.refine.grel.ast.VariableExpr; import com.google.refine.model.Column; import com.google.refine.model.Project; +import com.google.refine.util.PatternSyntaxExceptionParser; public class TextSearchFacet implements Facet { /* @@ -106,7 +107,8 @@ public class TextSearchFacet implements Facet { _query, _caseSensitive ? 0 : Pattern.CASE_INSENSITIVE); } catch (java.util.regex.PatternSyntaxException e) { - throw new JSONException(e); + PatternSyntaxExceptionParser err = new PatternSyntaxExceptionParser(e); + throw new JSONException(err.getUserMessage()); } } else if (!_caseSensitive) { _query = _query.toLowerCase();