Commit 5895e7ad authored by Benedikt Kleinmeier's avatar Benedikt Kleinmeier
Browse files

In "ProjectView", display a more meaningful error message when an exception...

In "ProjectView", display a more meaningful error message when an exception occurs during simulation run.

For this, use the text from the inner (causing) exception instead of the outer exception.
parent b14b087c
......@@ -182,8 +182,8 @@ Wizard.btnFinish.text=Finish
ProjectView.addScenarioDialog.text=New scenario name
ProjectView.addScenarioDialog.defaultValue=New_scenario
ProjectView.simulationRunErrorDialog.text=There was an unexpected exception in the scenario run of
ProjectView.simulationRunErrorDialog.title=Unexpected exception in scenario run
ProjectView.simulationRunErrorDialog.text=Unexpected error in scenario run
ProjectView.simulationRunErrorDialog.title=Unexpected error
ProjectView.testTable.test.text=Scenario
ProjectView.testTable.state.text=Status
......
......@@ -184,8 +184,8 @@ Wizard.btnFinish.text=Fertig
ProjectView.addScenarioDialog.text=Name des neuen Szenarios
ProjectView.addScenarioDialog.defaultValue=Neues_Szenario
ProjectView.simulationRunErrorDialog.text=Es kam zu einer unerwarteten Ausnahme im Simulationslauf des Szenarios
ProjectView.simulationRunErrorDialog.title=Unerwartet Ausnahme im Simulationslauf
ProjectView.simulationRunErrorDialog.text=Unerwarteter Fehler im Simulationslauf
ProjectView.simulationRunErrorDialog.title=Unerwarteter Fehler
ProjectView.testTable.test.text=Szenario
ProjectView.testTable.state.text=Status
......
......@@ -191,8 +191,15 @@ public class ProjectView extends JFrame implements ProjectFinishedListener, Sing
replace(scenario, VadereState.INTERRUPTED);
new Thread(
() -> {
IOUtils.errorBox(Messages.getString("ProjectView.simulationRunErrorDialog.text") + " " + scenario
+ ": " + throwable, Messages.getString("ProjectView.simulationRunErrorDialog.title"));
// Use the causing exception (if available) to get a more meaningful error message.
Throwable causingException = (throwable.getCause() == null) ? throwable : throwable.getCause();
String errorTextTemplate = "%s: %s\n\n%s";
String errorText = String.format(errorTextTemplate,
Messages.getString("ProjectView.simulationRunErrorDialog.text"),
scenario,
causingException);
IOUtils.errorBox(errorText, Messages.getString("ProjectView.simulationRunErrorDialog.title"));
}).start();
});
}
......
......@@ -278,19 +278,19 @@ public class IOUtils {
/** Shows an error box with given message and title. */
public static void errorBox(String infoMessage, String title) {
JOptionPane.showMessageDialog(null, infoMessage, "InfoBox: " + title,
JOptionPane.showMessageDialog(null, infoMessage, title,
JOptionPane.ERROR_MESSAGE);
}
/** Shows an warn box with given message and title. */
public static void warnBox(String infoMessage, String title) {
JOptionPane.showMessageDialog(null, infoMessage, "InfoBox: " + title,
JOptionPane.showMessageDialog(null, infoMessage, title,
JOptionPane.WARNING_MESSAGE);
}
/** Shows an info box with given message and title. */
public static void infoBox(String infoMessage, String title) {
JOptionPane.showMessageDialog(null, infoMessage, "InfoBox: " + title,
JOptionPane.showMessageDialog(null, infoMessage, title,
JOptionPane.INFORMATION_MESSAGE);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment