Class EmptyBrandException
java.lang.Object
java.lang.Throwable
java.lang.Exception
com.goldenleaf.shop.exception.EmptyBrandException
- All Implemented Interfaces:
Serializable
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 withnullor 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 Summary
ConstructorsConstructorDescriptionEmptyBrandException(String message) Constructs a new empty brand exception with the specified detail message.EmptyBrandException(String message, Throwable cause) Constructs a new empty brand 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
-
EmptyBrandException
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 byThrowable.getMessage()
-
EmptyBrandException
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 messagecause- the root cause of this exception- Since:
- 1.2
-