aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFelix Kehrer <felix.kehrer@gmail.com>2018-06-20 20:33:52 +0200
committerFelix Kehrer <felix.kehrer@gmail.com>2018-06-20 20:33:52 +0200
commit7884e7dfb93b6555f9470734209b4f188ee7a937 (patch)
tree49f5f2c9942428877c8b66c499a23023b42eed92
parent91e1248d777635a34e7d62c288c0aa38eba74205 (diff)
downloadsepm-groupproject-7884e7dfb93b6555f9470734209b4f188ee7a937.tar.gz
sepm-groupproject-7884e7dfb93b6555f9470734209b4f188ee7a937.tar.xz
sepm-groupproject-7884e7dfb93b6555f9470734209b4f188ee7a937.zip
Handle validation errors differently from other Exceptions #28864
-rw-r--r--src/main/java/at/ac/tuwien/sepm/assignment/groupphase/missioncontrol/controller/OperationDetailsController.java17
1 files changed, 13 insertions, 4 deletions
diff --git a/src/main/java/at/ac/tuwien/sepm/assignment/groupphase/missioncontrol/controller/OperationDetailsController.java b/src/main/java/at/ac/tuwien/sepm/assignment/groupphase/missioncontrol/controller/OperationDetailsController.java
index 937a86a..daeaedd 100644
--- a/src/main/java/at/ac/tuwien/sepm/assignment/groupphase/missioncontrol/controller/OperationDetailsController.java
+++ b/src/main/java/at/ac/tuwien/sepm/assignment/groupphase/missioncontrol/controller/OperationDetailsController.java
@@ -89,9 +89,12 @@ public class OperationDetailsController {
controller.getBtnRequest().setOnAction(e -> requestVehicleClicked(controller));
fpAdditional.getChildren().add(controller.getRootElement());
}
- } catch (IOException | ServiceException | InvalidOperationException e) {
+ } catch (IOException | ServiceException e) {
LOG.error("Error while updating list.", e);
showServiceExceptionAlertAndWait("Error while updating list.");
+ } catch (InvalidOperationException e) {
+ LOG.debug("Validation for Operation failed");
+ showValidationErrorAlertAndWait(e.getMessage());
}
}
@@ -160,17 +163,23 @@ public class OperationDetailsController {
private void requestVehicleClicked(VehiclePaneController v) {
LOG.debug("Button \"Nachfordern\" clicked.");
- Vehicle vehicle;
+ Vehicle vehicle = null;
try {
vehicle = v.getData();
if (vehicle == null) return;
operationService.requestVehicles(operation.id(), Set.of(vehicle.id()));
- } catch (ServiceException | InvalidOperationException | InvalidVehicleException e) {
- LOG.error("Exception in requestVehicleClicked()", e);
+ } catch (ServiceException e) {
+ LOG.error("ServiceException in requestVehicleClicked()", e);
showServiceExceptionAlertAndWait(e.getMessage());
return;
+ } catch (InvalidVehicleException e) {
+ LOG.debug("Validation of Vehicle failed");
+ showValidationErrorAlertAndWait(e.getMessage());
+ } catch (InvalidOperationException e) {
+ LOG.debug("Validation of Operation failed");
+ showValidationErrorAlertAndWait(e.getMessage());
}
showSuccessAlertAndWait("Das Fahrzeug wurde erfolgreich angefordert");
operation.vehicles().add(vehicle);