FunctionCall and ControlCall should catch exceptions and wrap them as EvalError's.

git-svn-id: http://google-refine.googlecode.com/svn/trunk@1777 7d457c2a-affb-35e4-300a-418c747d4874
This commit is contained in:
David Huynh 2010-11-05 04:26:10 +00:00
parent b282952448
commit fe08a43e0c
2 changed files with 12 additions and 2 deletions

View File

@ -35,6 +35,7 @@ package com.google.refine.grel.ast;
import java.util.Properties;
import com.google.refine.expr.EvalError;
import com.google.refine.expr.Evaluable;
import com.google.refine.grel.Control;
@ -51,7 +52,11 @@ public class ControlCallExpr implements Evaluable {
}
public Object evaluate(Properties bindings) {
try {
return _control.call(bindings, _args);
} catch (Exception e) {
return new EvalError(e.toString());
}
}
@Override

View File

@ -35,6 +35,7 @@ package com.google.refine.grel.ast;
import java.util.Properties;
import com.google.refine.expr.EvalError;
import com.google.refine.expr.Evaluable;
import com.google.refine.expr.ExpressionUtils;
import com.google.refine.grel.Function;
@ -63,7 +64,11 @@ public class FunctionCallExpr implements Evaluable {
}
args[i] = v;
}
try {
return _function.call(bindings, args);
} catch (Exception e) {
return new EvalError(e.toString());
}
}
public String toString() {