more informative error messages at simulation error
This commit is contained in:
parent
43062b6d74
commit
2c9316c5fa
@ -335,7 +335,7 @@ public abstract class MspMote extends AbstractEmulatedMote implements Mote, Watc
|
||||
if (t < lastExecute) {
|
||||
throw new RuntimeException("Bad event ordering: " + lastExecute + " < " + t);
|
||||
}
|
||||
|
||||
|
||||
/* Execute MSPSim-based mote */
|
||||
/* TODO Try-catch overhead */
|
||||
try {
|
||||
@ -345,6 +345,10 @@ public abstract class MspMote extends AbstractEmulatedMote implements Mote, Watc
|
||||
lastExecute = t;
|
||||
} catch (EmulationException e) {
|
||||
String stackTraceOutput = sendCLICommandAndPrint("stacktrace");
|
||||
if (stackTraceOutput == null) {
|
||||
stackTraceOutput = "";
|
||||
}
|
||||
stackTraceOutput = e.getMessage() + "\n\n" + stackTraceOutput;
|
||||
throw (ContikiError)
|
||||
new ContikiError(stackTraceOutput).initCause(e);
|
||||
}
|
||||
|
@ -253,8 +253,8 @@ public class Simulation extends Observable implements Runnable {
|
||||
this.setChanged();
|
||||
this.notifyObservers(this);
|
||||
|
||||
TimeEvent nextEvent = null;
|
||||
try {
|
||||
TimeEvent nextEvent;
|
||||
while (isRunning) {
|
||||
|
||||
/* Handle all poll requests */
|
||||
@ -289,7 +289,11 @@ public class Simulation extends Observable implements Runnable {
|
||||
/* Quit simulator if in test mode */
|
||||
System.exit(1);
|
||||
} else {
|
||||
GUI.showErrorDialog(GUI.getTopParentContainer(), "Simulation error", e, false);
|
||||
String title = "Simulation error";
|
||||
if (nextEvent instanceof MoteTimeEvent) {
|
||||
title += ": " + ((MoteTimeEvent)nextEvent).getMote();
|
||||
}
|
||||
GUI.showErrorDialog(GUI.getTopParentContainer(), title, e, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user