Class EmptyNameException
java.lang.Object
java.lang.Throwable
java.lang.Exception
com.goldenleaf.shop.exception.EmptyNameException
- All Implemented Interfaces:
Serializable
Checked exception thrown when an attempt is made to create or update an entity
that requires a non-empty name (full name, category name, product name, etc.)
but the provided name is
null, empty, or consists only of whitespace.
The name field is mandatory in many domain entities:
Userand its subclasses (Customer, Admin) – full nameCategory– category titleProduct– product titleCreditCard– cardholder name
Typical scenarios that trigger this exception:
- User registration or profile update with blank full name
- Creating a category/product without entering a name
- Adding a credit card with missing cardholder name
- Admin tools or data import processes submitting records with empty names
This is a checked exception, forcing the caller to handle the missing name explicitly. It represents an expected, recoverable validation error in normal application flow.
- Since:
- 1.0
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionEmptyNameException(String message) Constructs a new empty-name exception with the specified detail message.EmptyNameException(String message, Throwable cause) Constructs a new empty-name 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
-
EmptyNameException
Constructs a new empty-name exception with the specified detail message.- Parameters:
message- the detail message (e.g. "Name cannot be null or empty") Saved for later retrieval byThrowable.getMessage()
-
EmptyNameException
Constructs a new empty-name exception with the specified detail message and cause.Useful when wrapping a lower-level technical exception (e.g., constraint violation, parsing error, validation framework issue).
- Parameters:
message- the detail messagecause- the root cause of this exception- Since:
- 1.2
-