Class IncorrectRatingException

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

public class IncorrectRatingException extends Exception
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)
Values outside this range (0, negative numbers, 6+, fractional values, or null) are considered invalid and violate the business rules of the review system.

Typical scenarios that trigger this exception:

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 Details

    • IncorrectRatingException

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

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