Class EmptyAuthorException

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

public class EmptyAuthorException extends Exception
Checked exception thrown when an attempt is made to create or process a review without a valid author (customer).

This typically occurs in the Review entity or in methods such as Customer.makeReview(com.goldenleaf.shop.model.Product, java.lang.String, int). The author field must reference a persisted Customer and must not be null.

Example scenarios that trigger this exception:

  • Passing null as the customer when creating a review
  • Trying to save a review with an unassigned or detached author
  • Business logic violation where anonymous reviews are not allowed

This is a checked exception, forcing the caller to handle or declare it — appropriate for validation errors that are recoverable and expected in normal application flow.

Since:
1.0
See Also:
  • Constructor Details

    • EmptyAuthorException

      public EmptyAuthorException(String message)
      Constructs a new empty author exception with the specified detail message.
      Parameters:
      message - the detail message explaining why the author is invalid (e.g., "Review author (customer) cannot be null") The message is saved for later retrieval by Throwable.getMessage().
    • EmptyAuthorException

      public EmptyAuthorException(String message, Throwable cause)
      Constructs a new empty author exception with the specified detail message and cause.

      Useful when this exception is a wrapper around a lower-level exception (e.g., persistence or validation failure).

      Parameters:
      message - the detail message
      cause - the cause of this exception (can be retrieved later by Throwable.getCause())
      Since:
      1.2