Class EmptyNameException

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

public class EmptyNameException extends Exception
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:

Empty names would violate data integrity, search functionality, and user experience.

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 Details

    • EmptyNameException

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

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