Index: DefaultInterpreter.java
===================================================================
--- DefaultInterpreter.java	(revision 43520)
+++ DefaultInterpreter.java	(revision 43521)
@@ -13,7 +13,9 @@
 
 public class DefaultInterpreter implements Interpreter {
 
-    SymbolTable symbolTable = null;
+    private SymbolTable symbolTable = null;
+    private Double accuracy;
+    private Code currentCode;
 
     public DefaultInterpreter() {
         this.symbolTable = SQLSymbolTable.getInstance();
@@ -28,8 +30,17 @@
     public SymbolTable getSymbolTable() {
         return this.symbolTable;
     }
-
     @Override
+    public Double getAccuracy() {
+        return this.accuracy;
+    }
+    
+    @Override
+    public void setAccuracy(Double accuracy) {
+        this.accuracy = accuracy;
+    }
+    
+    @Override
     public Object run(Code code) {
         try {
             return this.runCode(code);
@@ -49,7 +60,7 @@
             if( caller.function() == null ) {
                 caller.function(this.symbolTable.function(caller.name()));
             }
-            if( caller.args()!=null ) {
+            if( caller.args() != null ) {
                 for( Code arg : caller.args() ) {
                     linkCode(arg);
                 }
@@ -58,6 +69,7 @@
     }
 
     private Object runCode(Code code) throws Exception {
+        this.currentCode = code;
         Object value = null;
         switch( code.code() ) {
         case Code.CONSTANT:
@@ -83,36 +95,52 @@
                 caller.function(function);
             }
             Arguments args = caller.args();
-            switch(caller.type()) {
-            case Caller.UNARY_OPERATOR:
-                if( args==null || args.count()!=1 ) {
-                    throw new RuntimeException("Number of argument mistmatch, expected 1 got "+args.count()+".");
+            try {
+                switch( caller.type() ) {
+                case Caller.UNARY_OPERATOR:
+                    if( args == null || args.count() != 1 ) {
+                        throw new RuntimeException("Number of argument mistmatch, expected 1 got " + args.count() + ".");
+                    }
+                    value = ((UnaryOperator) function).call(this, runCode(args.get(0)));
+                    break;
+
+                case Caller.BINARY_OPERATOR:
+                    if( args == null || args.count() != 2 ) {
+                        throw new RuntimeException("Number of argument mistmatch, expected 2 got " + args.count() + ".");
+                    }
+                    value = ((BinaryOperator) function).call(this, runCode(args.get(0)), runCode(args.get(1)));
+                    break;
+
+                case Caller.FUNCTION:
+                    int argc = (args == null) ? 0 : args.count();
+                    if( !function.argc().contains(argc) ) {
+                        throw new RuntimeException("Number of argument mistmatch, expected " + function.argc() + " got " + argc + ".");
+                    }
+                    Object[] argvalues = new Object[argc];
+                    if( args != null ) {
+                        int i = 0;
+                        for( Code arg : args ) {
+                            argvalues[i++] = runCode(arg);
+                        }
+                    }
+                    value = function.call(this, argvalues);
                 }
-                value = ((UnaryOperator)function).call(runCode(args.get(0)));
-                break;
-                
-            case Caller.BINARY_OPERATOR:
-                if( args==null || args.count()!=2 ) {
-                    throw new RuntimeException("Number of argument mistmatch, expected 2 got "+args.count()+".");
+            } catch (Exception ex) {
+                String argsstr = "???";
+                try {
+                    argsstr = args.toString();
+                } catch(Exception ex2) {
+                    // Ignore.
                 }
-                value = ((BinaryOperator)function).call(runCode(args.get(0)), runCode(args.get(1)));
-                break;
-                
-            case Caller.FUNCTION:
-                int argc = (args==null)? 0:args.count();
-                if( !function.argc().contains(argc) ) {
-                    throw new RuntimeException("Number of argument mistmatch, expected "+function.argc()+" got "+argc+".");
-                }
-                Object[] argvalues = new Object[argc];
-                if( args!=null ) {
-                    int i=0;
-                    for( Code arg : args) {
-                        argvalues[i++]=runCode(arg);
-                    }
-                }
-                value = function.call(argvalues);
+                throw new RuntimeException("Problems calling function '"+function.name()+"' with args ("+argsstr+").", ex);
             }
         }
+        this.currentCode = null;
         return value;
     }
+
+    @Override
+    public Code getCurrentCode() {
+        return this.currentCode;
+    }
 }
