Update Exception API

- Introduce a DuplicateOrderLineException to signal whenever somebody
wants to add the same product twice instead of using the increment
command.
- Introduce OrderAlreadyConfirmedException to signal whenever the order
is confirmed, so that adding products and incrementing/decrementing
their count is not possible once the order has been confirmed

#BAEL-4767
This commit is contained in:
Steven van Beelen 2021-03-19 11:04:12 +01:00
parent 2b2aff5ceb
commit ef1167b037
2 changed files with 16 additions and 0 deletions

View File

@ -0,0 +1,8 @@
package com.baeldung.axon.coreapi.exceptions;
public class DuplicateOrderLineException extends IllegalStateException {
public DuplicateOrderLineException(String productId) {
super("Cannot duplicate order line for product identifier [" + productId + "]");
}
}

View File

@ -0,0 +1,8 @@
package com.baeldung.axon.coreapi.exceptions;
public class OrderAlreadyConfirmedException extends IllegalStateException {
public OrderAlreadyConfirmedException(String orderId) {
super("Cannot perform operation because order [" + orderId + "] is already confirmed.");
}
}