better error handling #369

This commit is contained in:
rusefi 2017-03-12 14:12:08 -04:00
parent 6e8b54c7d0
commit 49bdeb0458
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. // 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) // Don't forget to reorder them in the original order (the one they appear in the evaluated formula)
if (values.size()<nb) { if (values.size()<nb) {
throw new IllegalArgumentException(); throw new IllegalArgumentException("Expected " + nb + " got " + values.size());
} }
LinkedList<T> result = new LinkedList<T>(); LinkedList<T> result = new LinkedList<T>();
for (int i = 0; i <nb ; i++) { for (int i = 0; i <nb ; i++) {

View File

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