Class IncorrectRatingException
java.lang.Object
java.lang.Throwable
java.lang.Exception
com.goldenleaf.shop.exception.IncorrectRatingException
- All Implemented Interfaces:
Serializable
Checked exception thrown when an attempt is made to create or save a product review
with a rating that falls outside the allowed range (typically 1–5 stars).
The rating in Review is a mandatory integer value
representing customer satisfaction. Valid ratings are strictly defined as:
- Minimum: 1 (lowest satisfaction)
- Maximum: 5 (highest satisfaction)
null)
are considered invalid and violate the business rules of the review system.
Typical scenarios that trigger this exception:
- User selects an invalid number of stars in the review form (e.g., due to UI bug or manipulation)
- Calling
Customer.makeReview(com.goldenleaf.shop.model.Product, java.lang.String, int)orReview.setRating(int)with an out-of-range value - Admin tool or API endpoint receiving malformed rating data
- Data import/migration process containing incorrect rating values
This is a checked exception, forcing the caller to explicitly handle invalid ratings. It represents a recoverable validation error commonly occurring during user-generated content submission — not a programming defect.
- Since:
- 1.0
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionIncorrectRatingException(String message) Constructs a new incorrect-rating exception with the specified detail message.IncorrectRatingException(String message, Throwable cause) Constructs a new incorrect-rating 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
-
IncorrectRatingException
Constructs a new incorrect-rating exception with the specified detail message.- Parameters:
message- the detail message (e.g. "Rating must be between 1 and 5") Saved for later retrieval byThrowable.getMessage()
-
IncorrectRatingException
Constructs a new incorrect-rating exception with the specified detail message and cause.Useful when wrapping lower-level validation errors (e.g., parsing failure, constraint violation, or third-party form validation issue).
- Parameters:
message- the detail messagecause- the root cause of this exception- Since:
- 1.2
-