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:
parent
b282952448
commit
fe08a43e0c
@ -35,6 +35,7 @@ package com.google.refine.grel.ast;
|
|||||||
|
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
|
|
||||||
|
import com.google.refine.expr.EvalError;
|
||||||
import com.google.refine.expr.Evaluable;
|
import com.google.refine.expr.Evaluable;
|
||||||
import com.google.refine.grel.Control;
|
import com.google.refine.grel.Control;
|
||||||
|
|
||||||
@ -51,7 +52,11 @@ public class ControlCallExpr implements Evaluable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public Object evaluate(Properties bindings) {
|
public Object evaluate(Properties bindings) {
|
||||||
return _control.call(bindings, _args);
|
try {
|
||||||
|
return _control.call(bindings, _args);
|
||||||
|
} catch (Exception e) {
|
||||||
|
return new EvalError(e.toString());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -35,6 +35,7 @@ package com.google.refine.grel.ast;
|
|||||||
|
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
|
|
||||||
|
import com.google.refine.expr.EvalError;
|
||||||
import com.google.refine.expr.Evaluable;
|
import com.google.refine.expr.Evaluable;
|
||||||
import com.google.refine.expr.ExpressionUtils;
|
import com.google.refine.expr.ExpressionUtils;
|
||||||
import com.google.refine.grel.Function;
|
import com.google.refine.grel.Function;
|
||||||
@ -63,7 +64,11 @@ public class FunctionCallExpr implements Evaluable {
|
|||||||
}
|
}
|
||||||
args[i] = v;
|
args[i] = v;
|
||||||
}
|
}
|
||||||
return _function.call(bindings, args);
|
try {
|
||||||
|
return _function.call(bindings, args);
|
||||||
|
} catch (Exception e) {
|
||||||
|
return new EvalError(e.toString());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public String toString() {
|
public String toString() {
|
||||||
|
Loading…
Reference in New Issue
Block a user