Class IncorrectBonusPointsValue
java.lang.Object
java.lang.Throwable
java.lang.Exception
com.goldenleaf.shop.exception.IncorrectBonusPointsValue
- All Implemented Interfaces:
Serializable
Checked exception thrown when an attempt is made to set or add an invalid number
of bonus points for a
Customer.
According to the current business rules, bonus points must always be non-negative (≥ 0). Negative values are not allowed because they would represent debt or an illogical state in the loyalty program.
Typical scenarios that trigger this exception:
- Creating a
Customerwith negative initial bonus points - Calling
Customer.setBonusPoints(int)orCustomer.addBonusPoints(int)with a negative value - Administrative tools or data imports mistakenly assigning negative points
- Attempting to deduct more points than the customer currently has (should be handled separately, but may also result in this exception)
This is a checked exception, requiring the caller to explicitly handle the invalid value. It represents a recoverable business-rule violation rather than a programming error.
- Since:
- 1.0
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionIncorrectBonusPointsValue(String message) Constructs a new incorrect-bonus-points exception with the specified detail message.IncorrectBonusPointsValue(String message, Throwable cause) Constructs a new incorrect-bonus-points exception with the specified detail message and cause. -
Method Summary
Methods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
Constructor Details
-
IncorrectBonusPointsValue
Constructs a new incorrect-bonus-points exception with the specified detail message.- Parameters:
message- the detail message (e.g. "Bonus points cannot be negative") Saved for later retrieval byThrowable.getMessage()
-
IncorrectBonusPointsValue
Constructs a new incorrect-bonus-points exception with the specified detail message and cause.Useful when wrapping a lower-level exception (e.g., arithmetic error, validation framework issue, or data parsing problem).
- Parameters:
message- the detail messagecause- the root cause of this exception- Since:
- 1.2
-