Class IncorrectBonusPointsValue

java.lang.Object
java.lang.Throwable
java.lang.Exception
com.goldenleaf.shop.exception.IncorrectBonusPointsValue
All Implemented Interfaces:
Serializable

public class IncorrectBonusPointsValue extends Exception
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 Customer with negative initial bonus points
  • Calling Customer.setBonusPoints(int) or Customer.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 Details

    • IncorrectBonusPointsValue

      public IncorrectBonusPointsValue(String message)
      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 by Throwable.getMessage()
    • IncorrectBonusPointsValue

      public IncorrectBonusPointsValue(String message, Throwable cause)
      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 message
      cause - the root cause of this exception
      Since:
      1.2