Class EmptyCardNumberException
java.lang.Object
java.lang.Throwable
java.lang.Exception
com.goldenleaf.shop.exception.EmptyCardNumberException
- All Implemented Interfaces:
Serializable
Checked exception thrown when an attempt is made to create or update a credit card
without providing a valid card number.
The card number is a mandatory, non-blank field for the CreditCard
entity. This exception enforces data integrity and prevents incomplete or invalid
payment method records from being persisted.
Common situations that trigger this exception:
- Passing
null, empty string, or whitespace-only value toCreditCard.setCardNumber(String) - User submitting a payment method form with missing card number
- Validation failure during checkout or payment method registration
- Importing or migrating payment data with incomplete records
This is a checked exception, requiring explicit handling or declaration. It represents a recoverable business/validation error rather than a programming defect.
- Since:
- 1.0
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionEmptyCardNumberException(String message) Constructs a new exception with the specified detail message.EmptyCardNumberException(String message, Throwable cause) Constructs a new 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
-
EmptyCardNumberException
Constructs a new exception with the specified detail message.- Parameters:
message- the detail message explaining the validation failure (e.g., "Credit card number cannot be null or empty") The message is saved for later retrieval byThrowable.getMessage()
-
EmptyCardNumberException
Constructs a new exception with the specified detail message and cause.Useful when this exception wraps a lower-level technical exception (e.g., from a payment gateway, validation framework, or constraint violation).
- Parameters:
message- the detail messagecause- the original cause of the error- Since:
- 1.2
-