From 703d2dbd198046ccac95509143b75a187f9089f8 Mon Sep 17 00:00:00 2001 From: David Huynh Date: Mon, 8 Nov 2010 21:19:25 +0000 Subject: [PATCH] IsTest should catch errors and wrap them. git-svn-id: http://google-refine.googlecode.com/svn/trunk@1833 7d457c2a-affb-35e4-300a-418c747d4874 --- main/src/com/google/refine/grel/controls/IsTest.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/main/src/com/google/refine/grel/controls/IsTest.java b/main/src/com/google/refine/grel/controls/IsTest.java index a06e70deb..e02bc94a9 100644 --- a/main/src/com/google/refine/grel/controls/IsTest.java +++ b/main/src/com/google/refine/grel/controls/IsTest.java @@ -38,6 +38,7 @@ import java.util.Properties; import org.json.JSONException; import org.json.JSONWriter; +import com.google.refine.expr.EvalError; import com.google.refine.expr.Evaluable; import com.google.refine.grel.Control; import com.google.refine.grel.ControlFunctionRegistry; @@ -51,8 +52,12 @@ abstract class IsTest implements Control { } public Object call(Properties bindings, Evaluable[] args) { - Object o = args[0].evaluate(bindings); - + Object o; + try { + o = args[0].evaluate(bindings); + } catch (Exception e) { + o = new EvalError(e.toString()); + } return test(o); }