Class EmptyBrandException

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

public class EmptyBrandException extends Exception
Checked exception thrown when an attempt is made to create or update a product without specifying a valid brand.

The brand is a mandatory attribute for Product entities in the system. This exception ensures data integrity by preventing products from being persisted with null or blank brand values.

Typical scenarios that trigger this exception:

  • Calling new Product(...) or a setter with null or empty brand
  • Submitting a product creation form with missing brand information
  • Validation failure during import or batch processing of products

Being a checked exception, it forces the caller to explicitly handle the situation — appropriate for business rule violations that are expected and recoverable in normal application flow.

Since:
1.0
See Also:
  • Constructor Details

    • EmptyBrandException

      public EmptyBrandException(String message)
      Constructs a new empty brand exception with the specified detail message.
      Parameters:
      message - the detail message (e.g., "Product brand cannot be null or empty") Saved for later retrieval by Throwable.getMessage()
    • EmptyBrandException

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

      Useful when wrapping a lower-level exception (e.g., from validation frameworks or database constraints).

      Parameters:
      message - the detail message
      cause - the root cause of this exception
      Since:
      1.2