more informative error messages at simulation error
This commit is contained in:
parent
43062b6d74
commit
2c9316c5fa
2 changed files with 11 additions and 3 deletions
|
@ -335,7 +335,7 @@ public abstract class MspMote extends AbstractEmulatedMote implements Mote, Watc
|
||||||
if (t < lastExecute) {
|
if (t < lastExecute) {
|
||||||
throw new RuntimeException("Bad event ordering: " + lastExecute + " < " + t);
|
throw new RuntimeException("Bad event ordering: " + lastExecute + " < " + t);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Execute MSPSim-based mote */
|
/* Execute MSPSim-based mote */
|
||||||
/* TODO Try-catch overhead */
|
/* TODO Try-catch overhead */
|
||||||
try {
|
try {
|
||||||
|
@ -345,6 +345,10 @@ public abstract class MspMote extends AbstractEmulatedMote implements Mote, Watc
|
||||||
lastExecute = t;
|
lastExecute = t;
|
||||||
} catch (EmulationException e) {
|
} catch (EmulationException e) {
|
||||||
String stackTraceOutput = sendCLICommandAndPrint("stacktrace");
|
String stackTraceOutput = sendCLICommandAndPrint("stacktrace");
|
||||||
|
if (stackTraceOutput == null) {
|
||||||
|
stackTraceOutput = "";
|
||||||
|
}
|
||||||
|
stackTraceOutput = e.getMessage() + "\n\n" + stackTraceOutput;
|
||||||
throw (ContikiError)
|
throw (ContikiError)
|
||||||
new ContikiError(stackTraceOutput).initCause(e);
|
new ContikiError(stackTraceOutput).initCause(e);
|
||||||
}
|
}
|
||||||
|
|
|
@ -253,8 +253,8 @@ public class Simulation extends Observable implements Runnable {
|
||||||
this.setChanged();
|
this.setChanged();
|
||||||
this.notifyObservers(this);
|
this.notifyObservers(this);
|
||||||
|
|
||||||
|
TimeEvent nextEvent = null;
|
||||||
try {
|
try {
|
||||||
TimeEvent nextEvent;
|
|
||||||
while (isRunning) {
|
while (isRunning) {
|
||||||
|
|
||||||
/* Handle all poll requests */
|
/* Handle all poll requests */
|
||||||
|
@ -289,7 +289,11 @@ public class Simulation extends Observable implements Runnable {
|
||||||
/* Quit simulator if in test mode */
|
/* Quit simulator if in test mode */
|
||||||
System.exit(1);
|
System.exit(1);
|
||||||
} else {
|
} 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 a new issue