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
|
@ -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 a new issue