Class EmptyExpiryException
java.lang.Object
java.lang.Throwable
java.lang.Exception
com.goldenleaf.shop.exception.EmptyExpiryException
- All Implemented Interfaces:
Serializable
Checked exception thrown when an attempt is made to create or update a credit card
without providing a valid expiry date (month/year).
The expiry date is a mandatory, non-null field for the CreditCard
entity. This exception ensures that only cards with a properly defined expiration
are accepted, preventing incomplete or invalid payment methods from being stored.
Typical scenarios that trigger this exception:
- User submits a payment method form without selecting or entering an expiry date
- Calling
CreditCard.setExpiry(java.time.YearMonth)withnull - Validation failure during checkout, registration of a new card, or data import
- Business rule enforcement – cards must have a defined expiration date
This is a checked exception, requiring the caller to handle the situation explicitly. It represents an expected, recoverable validation error rather than a programming bug.
- Since:
- 1.0
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionEmptyExpiryException(String message) Constructs a new empty-expiry exception with the specified detail message.EmptyExpiryException(String message, Throwable cause) Constructs a new empty-expiry 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
-
EmptyExpiryException
Constructs a new empty-expiry exception with the specified detail message.- Parameters:
message- the detail message (e.g. "Credit card expiry date cannot be null") Saved for later retrieval byThrowable.getMessage()
-
EmptyExpiryException
Constructs a new empty-expiry exception with the specified detail message and cause.Useful when this validation exception wraps a lower-level technical exception (e.g., parsing error, constraint violation, or payment gateway issue).
- Parameters:
message- the detail messagecause- the root cause of this exception- Since:
- 1.2
-