better error handling #369

This commit is contained in:
rusefi 2017-03-12 14:12:08 -04:00
parent 76dc1e2bf5
commit 39b0c24bf2
2 changed files with 12 additions and 6 deletions

View File

@ -193,7 +193,7 @@ public abstract class AbstractEvaluator<T> {
// Be aware that arguments are in reverse order on the values stack.
// Don't forget to reorder them in the original order (the one they appear in the evaluated formula)
if (values.size()<nb) {
throw new IllegalArgumentException();
throw new IllegalArgumentException("Expected " + nb + " got " + values.size());
}
LinkedList<T> result = new LinkedList<T>();
for (int i = 0; i <nb ; i++) {

View File

@ -1,6 +1,7 @@
package com.rusefi.ui.widgets;
import com.fathzer.soft.javaluator.DoubleEvaluator;
import com.rusefi.FileLog;
import com.rusefi.io.CommandQueue;
import com.rusefi.ui.RecentCommands;
import com.rusefi.ui.storage.Node;
@ -117,11 +118,16 @@ public class AnyCommand {
}
public static String prepareCommand(String rawCommand) {
if (rawCommand.startsWith("eval ")) {
return prepareEvalCommand(rawCommand);
} else if (rawCommand.startsWith("set_fsio_expression ")) {
return prepareSetFsioCommand(rawCommand);
} else {
try {
if (rawCommand.startsWith("eval ")) {
return prepareEvalCommand(rawCommand);
} else if (rawCommand.startsWith("set_fsio_expression ")) {
return prepareSetFsioCommand(rawCommand);
} else {
return rawCommand;
}
} catch (Throwable e) {
FileLog.MAIN.log(e);
return rawCommand;
}
}