Package javatro.core
Class JavatroException
java.lang.Object
java.lang.Throwable
java.lang.Exception
javatro.core.JavatroException
- All Implemented Interfaces:
Serializable
Custom exception class for handling application-specific errors in the Javatro game. Provides
factory methods for creating consistent exceptions with colored error messages.
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionJavatroException(String message) Constructs a JavatroException with a colored error message.JavatroException(String message, Throwable cause) Constructs a JavatroException with colored message and cause. -
Method Summary
Modifier and TypeMethodDescriptionstatic JavatroExceptionstatic JavatroExceptionerrorLoadingLogo(String fileName) Creates exception for missing resource file.static JavatroExceptionexceedsMaxCardSelection(int maxCardsToSelect) Creates exception for exceeding maximum card selection.static JavatroExceptionstatic JavatroExceptionindexOutOfBounds(int index) Creates exception for index out of bounds.static JavatroExceptionstatic JavatroExceptionstatic JavatroExceptionstatic JavatroExceptionstatic JavatroExceptioninvalidMenuInput(int maxRange) Creates exception for invalid menu input range.static JavatroExceptionstatic JavatroExceptionstatic JavatroExceptioninvalidPlayedHand(int minCards, int maxCards) Creates exception for invalid number of cards in a poker hand.static JavatroExceptionstatic JavatroExceptionstatic JavatroExceptionstatic JavatroExceptionCreates an exception indicating the deck is empty.static JavatroExceptionCreates an exception indicating no plays remaining.static JavatroExceptionstatic JavatroExceptionMethods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
Constructor Details
-
JavatroException
Constructs a JavatroException with a colored error message.- Parameters:
message- The error message to display (will be colored red)
-
JavatroException
Constructs a JavatroException with colored message and cause.- Parameters:
message- The error message to display (colored red)cause- The underlying cause of the exception
-
-
Method Details
-
invalidPlayedHand
Creates exception for invalid number of cards in a poker hand.- Parameters:
minCards- Minimum allowed cardsmaxCards- Maximum allowed cards- Returns:
- Configured exception instance
-
invalidPlaysPerRound
- Returns:
- Exception for invalid plays per round configuration
-
invalidBlindScore
- Returns:
- Exception for invalid blind score input
-
invalidDeck
- Returns:
- Exception for null deck configuration
-
noCardsRemaining
Creates an exception indicating the deck is empty.This exception is thrown when all the cards in the deck have been drawn.
- Returns:
- A
JavatroExceptionindicating the deck is empty.
-
noPlaysRemaining
Creates an exception indicating no plays remaining.This exception is thrown when the user tries to play cards when no plays are remaining.
- Returns:
- A
JavatroExceptionindicating that no plays are remaining.
-
invalidCardInput
- Returns:
- Exception for invalid card selection input
-
exceedsMaxCardSelection
Creates exception for exceeding maximum card selection.- Parameters:
maxCardsToSelect- Maximum allowed cards- Returns:
- Configured exception instance
-
invalidMenuInput
Creates exception for invalid menu input range.- Parameters:
maxRange- Maximum valid input value- Returns:
- Configured exception instance
-
invalidInputType
- Returns:
- Exception for non-numeric input where number expected
-
invalidOptionsTitle
- Returns:
- Exception for missing or empty options title
-
invalidOptionsSize
- Returns:
- Exception for invalid options list size
-
invalidScreen
- Returns:
- Exception for null screen reference
-
indexOutOfBounds
Creates exception for index out of bounds.- Parameters:
index- Invalid index that was accessed- Returns:
- Configured exception instance
-
errorLoadingLogo
Creates exception for missing resource file.- Parameters:
fileName- Name of missing file- Returns:
- Configured exception instance
-
invalidSelectionLimit
- Returns:
- Exception for invalid selection limit
-
noRemainingDiscards
- Returns:
- Exception when no discards remain
-
tooManyDiscards
- Returns:
- Exception for exceeding discard limit
-
cannotDiscardZeroCards
- Returns:
- Exception for attempting zero discards
-
exceedsMaxJokers
- Returns:
- Exception for exceeding maximum joker limit
-