unified handling of runtime exceptions

This commit is contained in:
hneemann 2017-03-31 08:54:07 +02:00
parent de4f1cbfb8
commit 228e990557
2 changed files with 9 additions and 9 deletions

View File

@ -93,8 +93,8 @@ public class RealTimeClock implements ModelStateObserver {
output.setValue(1 - output.getValue()); output.setValue(1 - output.getValue());
model.doStep(); model.doStep();
}); });
} catch (NodeException e1) { } catch (NodeException | RuntimeException e) {
stopper.showErrorAndStopModel(Lang.get("msg_clockError"), e1); stopper.showErrorAndStopModel(Lang.get("msg_clockError"), e);
timer.cancel(false); timer.cancel(false);
} }
} }
@ -128,8 +128,8 @@ public class RealTimeClock implements ModelStateObserver {
}); });
counter++; counter++;
} }
} catch (Exception e1) { } catch (NodeException | RuntimeException e) {
stopper.showErrorAndStopModel(Lang.get("msg_clockError"), e1); stopper.showErrorAndStopModel(Lang.get("msg_clockError"), e);
} }
time = System.currentTimeMillis() - time; time = System.currentTimeMillis() - time;

View File

@ -676,7 +676,7 @@ public class Main extends JFrame implements ClosingWindowListener.ConfirmSave, E
windowPosManager.register("testresult", new TestResultDialog(Main.this, tsl, circuitComponent.getCircuit(), library)).setVisible(true); windowPosManager.register("testresult", new TestResultDialog(Main.this, tsl, circuitComponent.getCircuit(), library)).setVisible(true);
stoppedState.enter(); stoppedState.enter();
} catch (Exception e1) { } catch (NodeException | ElementNotFoundException | PinException | TestingDataException | RuntimeException e1) {
showErrorAndStopModel(Lang.get("msg_runningTestError"), e1); showErrorAndStopModel(Lang.get("msg_runningTestError"), e1);
} }
} }
@ -697,7 +697,7 @@ public class Main extends JFrame implements ClosingWindowListener.ConfirmSave, E
new TableDialog(Main.this, new ModelAnalyser(model).analyse(), shapeFactory, filename) new TableDialog(Main.this, new ModelAnalyser(model).analyse(), shapeFactory, filename)
.setVisible(true); .setVisible(true);
stoppedState.enter(); stoppedState.enter();
} catch (PinException | NodeException | AnalyseException | ElementNotFoundException e1) { } catch (PinException | NodeException | AnalyseException | ElementNotFoundException | RuntimeException e1) {
showErrorAndStopModel(Lang.get("msg_annalyseErr"), e1); showErrorAndStopModel(Lang.get("msg_annalyseErr"), e1);
} }
} }
@ -741,8 +741,8 @@ public class Main extends JFrame implements ClosingWindowListener.ConfirmSave, E
.showDialog()) { .showDialog()) {
circuitComponent.getCircuit().setMeasurementOrdering(names); circuitComponent.getCircuit().setMeasurementOrdering(names);
} }
} catch (Exception e1) { } catch (NodeException | PinException | ElementNotFoundException | RuntimeException e) {
showErrorAndStopModel(Lang.get("msg_errorCreatingModel"), e1); showErrorAndStopModel(Lang.get("msg_errorCreatingModel"), e);
} }
} }
@ -1122,7 +1122,7 @@ public class Main extends JFrame implements ClosingWindowListener.ConfirmSave, E
} }
circuitComponent.hasChanged(); circuitComponent.hasChanged();
addressPicker.getProgRomAddr(model); addressPicker.getProgRomAddr(model);
} catch (NodeException e) { } catch (NodeException | RuntimeException e) {
showErrorAndStopModel(Lang.get("err_remoteExecution"), e); showErrorAndStopModel(Lang.get("err_remoteExecution"), e);
} }
} }